square/okhttp — pull request #1006 by nfuller (2014-07-29 14:32:57+00:00)
Title: Fix transparent gzip for basic auth.

Externally reported Android bug:
https://code.google.com/p/android/issues/detail?id=74026

This change involves backporting this commit from 2.0 to 1.6:
https://github.com/square/okhttp/commit/9abfde9e5ad7c67ddad907c55bfb2378bc65082c

There have been many changes between 1.6 and that commit that touch
related code. Details of those changes are below.

A test has been added to demonstrate the fix.

Changes that are related and had to be accomodated:

https://github.com/square/okhttp/commit/da484932625ab15681e469c1680b6371b8f67080
- Change: Replace TunnelRequest with a regular Request
- Impact: HttpEngine: getTunnelConfig() replaced.
- Action: Not applied. Worked around.

https://github.com/square/okhttp/commit/ee2ed56c9ad4563f5713ff0f572a5454af16901d
- Change: Track redirectedBy in HttpEngine.
- Impact: Addition of a new parameter (redirectedBy) to HttpEngine.
- Action: Partially applied - added the parameter to HttpEngine / HttpUrlConnectionImpl
but not Call (does not exist in 1.6). Some test changes backported, some excluded.

https://github.com/square/okhttp/commit/d30c48a1943f165cbd18a33b629b15434079a15a
- Change: Rename of redirectedBy to priorResponse
- Impact: Response, HttpEngine, HttpURLConnectionImpl
- Action: Applied.

https://github.com/square/okhttp/commit/520d9fc2bc6b251a998b58794070f8bebee9d682
- Change: Support common http verbs including zero length POST, DELETE.
- Impact: HttpEngine: Introduction of Util.emptySink() check in hasRequestBody()
- Action: Not applied. Ignored additional check.

https://github.com/square/okhttp/commit/8e9d8f6fbf4a505417ead296b2c2a1bb15e6ba5c
- Change: Change the signature of OkResponseCache.maybeRemove
- Impact: Changed HttpResponseCache.maybeRemove() to remove() and pulled condition
code into caller.
- Action: Not applied. Worked around.

https://github.com/square/okhttp/commit/9546527a1c34400a0020f50fe58ffd1f109800ab
- Change: Removed httpMinorVersion().
- Impact: HttpEngine: connection.setHttpMinorVersion(networkResponse.httpMinorVersion())
-> connection.setProtocol(response.protocol());
- Action: Not applied. Left as is.

https://github.com/square/okhttp/commit/1044d9eea21d8be54c195fff75ca0a7b9bba79b3
- Change: Introduction of Internal class methods.
- Impact: HttpEngine: connection.setProtocol(response.protocol())
-> Internal.instance.setProtocol(connection, response.protocol())
- Action: Not applied. Left as is.

https://github.com/square/okhttp/commit/825b31dc5ca5be249b165e8c6ae90340f3c678d1
- Change: Basic support for OAuth in OkAuthenticator
- Impact: URLConnectionTest
- Action: Not applied. Left as is.