• Home
  • History
  • Annotate
  • only in /external/okhttp/okhttp-tests/src/test/java/com/squareup/okhttp/
History log of /external/okhttp/okhttp-tests/src/test/java/com/squareup/okhttp/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
cdbc32fcc601fedaf0f6a8179f61a28845b98364 11-Jan-2018 Tobias Thierer <tobiast@google.com> Revert "Revert "OkHostnameVerifier: Don't fall back to CN verification.""

This reverts commit cd3f2cecf3112d8c3da9ea20ddd620008d2fb6e6.

Reason for revert: Corresponding test changes are in associated CL in this CL topic, so this CL can roll forward again.

Bug: 70278814
Test: Ran CtsLibcoreOkHttpTestCases when the original CL was submitted.
Change-Id: I22a96acced8bd9f20d943a7ab9f8f73ce73abeaa
nternal/tls/HostnameVerifierTest.java
cd3f2cecf3112d8c3da9ea20ddd620008d2fb6e6 10-Jan-2018 Tobias Thierer <tobiast@google.com> Revert "OkHostnameVerifier: Don't fall back to CN verification."

This reverts commit a3bfc8019febb4529634b41fca18c8d955ef5e90.

Reason for revert: Broke a bunch of libcore tests. Those need to be updated.

Bug: 70278814
Change-Id: Ie04b8d2bd252a17cbb78ea24ffdea92e08fadfbe
nternal/tls/HostnameVerifierTest.java
a3bfc8019febb4529634b41fca18c8d955ef5e90 05-Jan-2018 Tobias Thierer <tobiast@google.com> OkHostnameVerifier: Don't fall back to CN verification.

The use of Common Name was deprecated in RFC 2818 (May 2000), section 3.1:

Although the use of the Common Name is existing practice, it is
deprecated and Certification Authorities are encouraged to use the
dNSName instead.

This backports upstream commit 52764cb4b9219d699b66e96ccf54db1c37c638bb
from https://github.com/square/okhttp/pull/3764

Bug: 70278814
Test: CtsLibcoreOkHttpTestCases
Change-Id: Iefa8645b93103d70f057a872ac4332147bc2d4d2
nternal/tls/HostnameVerifierTest.java
7cf56bd49b8d529696b080a1ca6b69ae635b8233 24-Oct-2016 Tobias Thierer <tobiast@google.com> Merge "Apply: Make IPv6 request lines consistent with Firefox and Chrome."
757558d44f11770d9d7710f6811d6bd784fc98d7 19-Oct-2016 Tobias Thierer <tobiast@google.com> Apply: Recover more gracefully when an editor is detached.

Backport upstream commit aae1a45bcb6dd2ffd3b0b87525bbef4e4517ddba

An app reported crashes whose stacktrace appears to match upstream
bug https://github.com/square/okhttp/issues/2420

Therefore this CL is backporting the corresponding fix.

Bug: 31823815
Test: mvn clean verify
Test: cts-tradefed run cts -m CtsLibcoreOkHttpTestCases
Test: cts-tradefed run cts -m CtsLibcoreTestCases -a arm64-v8a

Original commit message follows:

We had a bug where we could have two editors for the same entry. This
would occur when the cache was cleared, or if the entry was otherwise
evicted while the edit was in progress.

Previously the two editors would corrupt each other, and potentially
the cache's size. With this change the detached editor is limited and
harmless.

Change-Id: I56e3a27187f2df025c99916daed24acc63d589d3
nternal/DiskLruCacheTest.java
eaf55917fcd2f118e26d6b31dcaf9fb8f3ad0d1f 22-Feb-2016 jwilson <jwilson@squareup.com> Apply: Make IPv6 request lines consistent with Firefox and Chrome.

Backport upstream OkHttp commit 7ceaa2387f0be853222f5a1496f1f743fa6f8c6d
(from OkHttp 3.2) to Android. Because Android's OkHttp is based on
2.7.5, this involved tweaks in CallTest and elsewhere to
- in CallTest to call setters on OkHttpClient instead of using a
OkHttpClient.Builder to construct a new instance.
- use request.httpUrl() instead of OkHttp 3's request.url().
- dropped a "." at the end of a line comment in Http2xStream.java
to keep the line length at 100 characters to avoid breaking
style checks when running OkHttp's tests using "mvn clean verify"

This commit fixes two separate bugs (upstream may only have been aware
of (1.)):

(1.) when attempting to tunnel a https connection over http, the host
header didn't include the :443, like it should.
This bug was not tracked on Android as far as I'm aware;
URLConnectionTest was previously asserting the incorrect behavior.
(2.) attempting to connect to a literal IPv6 address such as
http://[::1]/ would crash because HttpUrl's host accessor
returned the "::1" without [] but HttpUrl.Builder required the
[]; this broke the round-trip in HttpEngine.createAddress().
It's likely that this is the root cause of bug 31917371 but
it hasn't been empirically verified that this CL fixes that bug.

To fix (2.), it would probably have been sufficient to only apply the
change to HttpUrl.java, but fixing both bugs and backporting the entire
upstream CL appeared preferable.

Bug: 31917371
Test: cts-tradefed run cts -m CtsLibcoreOkHttpTestCases -a arm64-v8a

Upstream commit message follows:

Previously we omitted the square braces and explicit port on CONNECT requests
and the square braces in the Host header.

Closes https://github.com/square/okhttp/issues/2344

Change-Id: I844bfc06bf3a4f56a61a825a71165367ad762a15
allTest.java
ttpUrlTest.java
RLConnectionTest.java
0771ad685deef1ac376a28dd67ca1921c52bfd8a 10-Aug-2016 Neil Fuller <nfuller@google.com> Use different URL encoding for single quote in query

Single quotes in query parameters in HttpURLConnection changed
behavior between M and N due to upstream changes in OkHttp:
in N, single quotes started being encoded as %27 when present in
query parameters. Unfortunately, this broke several "iTunes remote"
apps: iTunes appears not to support %27 encoding for single quotes
in its DAAP server.

Bug: 30405333
Test: (old) cts test packages android.core.tests.libcore.package.okhttp
and android.core.tests.libcore.package.libcore
(cherry picked from commit da039605fac12ce27a4e9e07e3ace8d4a4108868)

Change-Id: I5a9f3e343b82fb2c30a1999ca4d4799445c336bf
ttpUrlTest.java
ba1bef962d8a2af12f506211b232618ccb853161 15-Sep-2016 Chad Brubaker <cbrubaker@google.com> Avoid using SSLv3 in tests

With conscrypt and libcore dropping SSLv3 calling
setEnabledProtocols() with SSLv3 will fail.

Bug: 30977793
Test: cts-tradefed run singleCommand cts -m CtsLibcoreOkHttpTestCases && libcore/run-libcore-tests libcore/luni/src/test/java/libcore/java/net/URLConnectionTest.java
Change-Id: I0b7176a4a0246c5355b174546295cf7a02f1f9ee
onnectionSpecTest.java
ad7dbdba5451eb03fa1c256a3e12c2a6b104779c 16-Sep-2016 Chad Brubaker <cbrubaker@google.com> Avoid using RC4 ciphers in tests

Conscrypt no longer supports RC4 ciphers, so move the tests to support
ciphers.

Bug: 30977793
Test: cts-tradefed run cts -m CtsLibcoreOkHttpTestCases
Change-Id: I49c2521a8e4fec2bcd09c07a9e42d395fcd91089
onnectionSpecTest.java
1917ec9635dea723538ea000b67b105999e58710 09-Sep-2016 Tobias Thierer <tobiast@google.com> Apply upstream commit: Allow HTAB in header values.

This applies upstream commit
02b08fbde7b1726d7a4c0dc971152751ac82ca0a

Due to deviation between upstream and AOSP, the change was applied
manually.

RFC 7230 section 3.2 allows HTAB ('\t', '\u0009') inside header
values as long as there is not more than one in a row:
https://tools.ietf.org/html/rfc7230#section-3.2

Before this CL, OkHttp previously disallowed HTAB in header values.
This CL changes behavior to allow any number of consecutive HTABs
inside a header value; this is more permissive than the RFC, but
is consistent with how OkHttp currently treats space characters
(' ', '\u0020').

Bug: 30799514

Test: mvn clean verify
Test: run cts -m CtsLibcoreTestCases
Test: run cts -m CtsLibcoreOkHttpTestCases

Change-Id: I0dd68d1697affaf739167174970d52e466a2bc16
equestTest.java
nternal/http/HeadersTest.java
078ce1ecb0917cbf08ab74325e6fe1fa6474c2a7 29-Jul-2016 Tobias Thierer <tobiast@google.com> Revert "Fix regression in the HTTP request line"

This reverts commit 8e96772d82220b49aa27a4cbeca1578620fd9223.

This revert reintroduces a change the behavior of Http(s)URLConnection:
URLs with an empty path ("http://example.com") now get normalized to
a path with one empty element ("http://example.com/").

There was only one known case where the change in behavior caused
problems with a server, however that is no longer reproducable (perhaps
the server has been fixed). Therefore, it seems safe to introduce the
behavior change now.

The advantage of introducing this behavior change now is that we don't
need to carry this local patch. This makes it easier to update to later
versions of OkHttp in future.

Bug: 30107354
Change-Id: Ib505530274867375dabebb305e8005038d8f650d
ttpUrlTest.java
RLConnectionTest.java
8e96772d82220b49aa27a4cbeca1578620fd9223 13-Jul-2016 Tobias Thierer <tobiast@google.com> Fix regression in the HTTP request line

Adds a test that demonstrates a regression from M in
the HTTP request line when a proxied connection
is made. It only affects URLs with empty paths (i.e. ones
without even a '/' after the host / authority). For
example, on M the request line for a request to
new URL("http://myhost").openConnection() would be:

GET http://myhost HTTP/1.1

but on N, without this change, it would be:

GET http://myhost/ HTTP/1.1

This change reverts to the M behavior.

Test: As follows:
* All OkHttp tests. All pass.
* All libcore tests. 13 tests fail but these were already failing
per b/29744850 and b/29496407. URLConnectionTest passes.
* Manually went through non-test usages of HttpUrl's methods
toString(), encodedPath(), pathSegmentsToString(),
encodedPathSegments(), pathSize() and convinced myself
that all of these usages dealt correctly with empty paths.
For toString(), this includes usages of
- Request.urlString() (used by Cache),
- Appendable.append(HttpUrl) (used in RequestLine.get()),
- Occurences of "url +" (tests only) and "+ url"
(tests, exception messages, and places that call methods
not relating to paths on a HttpUrl instance).

(cherry-picked from commit af79cbf93ef9c369e0d10c449ad23e970a62ef79)
Bug: 30107354
Bug: 29983827
Change-Id: If6ada6e6718fb2ffeef51ac27e4a69fa8c6e3a8e
ttpUrlTest.java
RLConnectionTest.java
231519b0362806e99f234e4bd136d04627605f73 21-Jun-2016 Tobias Thierer <tobiast@google.com> Apply upstream commit: Let SocksProxy use the same definition of localhost as MockWebServer.

This fixes SocksProxyTest failing on some systems. The problem was that
MockWebServer is listening on InetAddress.getByName("localhost") but
SocksProxy was trying to connect to InetAddress.getLoopbackAddress().
This is not guaranteed to work, for example on recent AOSP, "localhost"
resolves to 127.0.0.1 but getLoopbackAddress() is ::1 (IPv6).

This CL makes the simplest change to make the two consistent so that
SocksProxyTest passes. In the long run, OkHttp may want to consider
using getLoopbackAddress().getHostname() everywhere instead of hard
coding the hostname "localhost" at all.

(cherry picked from upstream commit df73a7e98e8450813325d28458b6bdd4b8b11791)

Change-Id: Ib0e860ea1a8646c4e2b9739974486159294a8fdc
ocksProxy.java
86a4f0d3830d797f7e915c7aa7b3fde524e5cad4 25-May-2016 Neil Fuller <nfuller@google.com> Reapply: Relax validation of HTTP header values to retain L/M behavior

This reapplies AOSP commit 3c28a1372bd9090bed083f9212369b2b76f99ace
There is a chance that we may want to revert this change in future.

Previous commit message:

This relaxes some validation logic newly introduced in the version
of OkHttp used in N.

This change leaves the character code validation stricter
than it was in M by still preventing control codes like \n, \r,
backspace and delete. It does allow developers to pass
Java characters > 7F to addRequestProperty() and also receive
headers from servers which contain characters > 7F.

Android's HttpURLConnection does not follow the HTTP spec as
it encodes request header values and interprets response
headers as UTF-8 and not ISO-8859-1.

If a server is expecting or sending ISO-8859-1 encoded characters
>7F in headers then these will still be corrupted or misinterpreted
by Android. However, this has been the behavior since L and is not
changed here.

The OkHttp change which caused characters >7F to generate an
IllegalArgumentException and partially reverted here:
https://github.com/square/okhttp/pull/1785

See also: https://github.com/square/okhttp/issues/1998
https://github.com/square/okhttp/issues/2016
for recent upstream bugs.

Bug: 28867041
Bug: https://code.google.com/p/android/issues/detail?id=210205
(cherry picked from commit 75687ca5ae54f417afb4c02ba04767da6786d829)

Change-Id: Id683ec13142f1d7d8792143066f1dd2e5f62cf86
equestTest.java
RLConnectionTest.java
637ebbfbb73ebcb37919fe4d855c8d5fca98eee1 16-Mar-2016 Neil Fuller <nfuller@google.com> Reapply an upstream OkHttp change to Android for HttpUrl

This was originally commited to AOSP as 3281dee547ef61c7c792a6e2b94b4b66b0486376
The upstream commit was part of OkHttp 3.0 but not 2.7.5.

Previous commit message:

Manually reapplied change from upstream to address HttpUrl encoding issues.
This change did not apply cleanly. Upstream FormEncodingBuilder has
been refactored. Equivalent changes have been made.

Upstream details:
Comment:
Never throw converting an HttpUrl to a java.net.URI.

Just do arbitrary amounts of transformation. Sigh.

Closes https://github.com/square/okhttp/issues/2116
SHA: d77edcc8905148f18a691be180c4f8f366a5ee1b

Change-Id: I588e8906c22d2db565e4582a454fa5894071feae
ttpUrlTest.java
31b5584ac2fedeb039c1bdd67db08ca2d843e51d 11-Jan-2016 Neil Fuller <nfuller@google.com> Workaround for request header values with trailing '\r' or '\n'

This CL reapplies the effect of three previous AOSP CLs.
This CL is not merged into the base CLs because we may want to
revert this set of changes one day.

The original CLs which are combined into this one are:

- Workaround for request header values with trailing '\n'
AOSP commit 28c5794fc131ded439a3b3b0d959ee9e134ec3af
- Workaround for request header values with trailing '\r' or '\r\n'
AOSP commit 8ef2daccd20f80b439c93af7d7985fb26d1f6b2f
- okhttp: add workaround in RequestTest for \r
AOSP commit 2a168a5cf9e08f207172aa0d3a8395a2b7b7434f

Change-Id: I217a6f52d3d9aed48156d5a46e52b2fd4a673162
equestTest.java
cf362b8db836b1752eb90f7c64fb1d71c4744144 24-Jun-2016 Tobias Thierer <tobiast@google.com> Android modifications to existing files from OkHttp / okio

This CL contains all changes to existing files that were previously
introduced by AOSP commit 36132b3cd2c814e057c775adc821ae0fb12aeb4c

In addition, this CL adds assertNotEquals() to RealWebSocketTest.java
to make it run on AOSP's version of JUnit.

This commit reverts all of the changes to okio from the previous CL
*except* for slight tweaks to README.android.

Change-Id: Ia6c8c3ae33573f8bb3bfd638376f1421286472b2
ttpUrlTest.java
6c251e20f00c7574b217bd4351ac81666f574380 24-Jun-2016 Tobias Thierer <tobiast@google.com> Update OkHttp to 2.7.5 and advance okio by one commit.

This brings OkHttp and okio exactly in line with upstream commits
with no local changes.

Corresponding upstream commits:
okhttp:6e236ce3b80f21369dc544f0e1053ff71be8689b (= parent-2.7.5)
okio: 02481cc0cc84bc92e3eab6d5212a226496f56a7e

The okio commit differs from the one in the previous pull from
Sep 2015 (AOSP commit 71b9f47b26fb57ac3e436a19519c6e3ec70e86eb)
only by a single upstream commit, the switch to 8 KiB segments.
That commit was previously cherry-picked in AOSP. This CL will
temporarily revert the AOSP changes to okio, but those
AOSP changes to okio will be reapplied in the subsequent CL.

Compilation and tests do not pass after this CL, they will only
pass at the end of the chain of 11 CLs going in at the same time.
9 of these 11 CLs are in external/okhttp, the others affect
libcore and frameworks/base.

Details of behavioural changes introduced by this upgrade are at:
https://docs.google.com/document/d/19PF3Exd_q32gAGCiRFWRf0Pq_xrIWs-cRViHkFTxJg8/edit

This CL includes files that are not used in Android, such as
- top level dot files (.travis.yml etc.)
- subdirectories okurl, okhttp-apache, samples, which aren't used
- tests in okhttp-hpacktests, okhttp-ws-tests that aren't run
or test functionality that we aren't used

Test: I've run the following tests *at the end* of the chain of
commits, in cts-tradefed:
1.) run cts -p android.core.tests.libcore.package.harmony_java_net
2.) run cts -c libcore.java.net.URLConnectionTest
3.) run cts -p android.core.tests.libcore.package.okhttp
4.) run cts -p android.core.tests.libcore.package.libcore

1.-3.) all passed
4.) had 24 unrelated failures per b/29496407 and b/29744850

Change-Id: Id798d6cf49fa4a7a4ab8ae3b699a38104bf42db3
ddressTest.java
acheTest.java
allTest.java
ertificatePinnerTest.java
onnectionPoolTest.java
onnectionReuseTest.java
onnectionSpecTest.java
elegatingSSLSocketFactory.java
ttpUrlTest.java
nterceptorTest.java
ecordingCallback.java
equestTest.java
ocksProxy.java
ocksProxyTest.java
RLConnectionTest.java
nternal/DoubleInetAddressDns.java
nternal/DoubleInetAddressNetwork.java
nternal/SingleInetAddressDns.java
nternal/SingleInetAddressNetwork.java
nternal/framed/Http2ConnectionTest.java
nternal/framed/HttpOverHttp2Test.java
nternal/framed/HttpOverSpdy3Test.java
nternal/framed/HttpOverSpdyTest.java
nternal/framed/Spdy3ConnectionTest.java
nternal/http/FakeDns.java
nternal/http/HeadersTest.java
nternal/http/HttpOverHttp2Test.java
nternal/http/HttpOverSpdy3Test.java
nternal/http/HttpOverSpdyTest.java
nternal/http/RouteSelectorTest.java
nternal/tls/CertificateChainCleanerTest.java
nternal/tls/CertificatePinnerChainValidationTest.java
f239c0f32bf1dd823f299583c13a905aa907e1eb 20-Jun-2016 Tobias Thierer <tobiast@google.com> Revert "Temporary workaround for whatsapp issues."

WhatsApp have address this issue so we no longer need the workaround.

This reverts commit cdf3c4bc9e853c99d82d4c1dfc907ef2694f2ed7.

Bug: 27353040
Change-Id: I41f68860bf04adcb231b316b0eaa3f32ba294ff7
nterceptorTest.java
3c28a1372bd9090bed083f9212369b2b76f99ace 25-May-2016 Neil Fuller <nfuller@google.com> Relax validation of HTTP header values to retain L/M behavior

This relaxes some validation logic newly introduced in the version
of OkHttp used in N.

This change leaves the character code validation stricter
than it was in M by still preventing control codes like \n, \r,
backspace and delete. It does allow developers to pass
Java characters > 7F to addRequestProperty() and also receive
headers from servers which contain characters > 7F.

Android's HttpURLConnection does not follow the HTTP spec as
it encodes request header values and interprets response
headers as UTF-8 and not ISO-8859-1.

If a server is expecting or sending ISO-8859-1 encoded characters
>7F in headers then these will still be corrupted or misinterpreted
by Android. However, this has been the behavior since L and is not
changed here.

The OkHttp change which caused characters >7F to generate an
IllegalArgumentException and partially reverted here:
https://github.com/square/okhttp/pull/1785

See also: https://github.com/square/okhttp/issues/1998
https://github.com/square/okhttp/issues/2016
for recent upstream bugs.

Bug: 28867041
Bug: https://code.google.com/p/android/issues/detail?id=210205
(cherry picked from commit 75687ca5ae54f417afb4c02ba04767da6786d829)

Change-Id: Ib640b58addff4c0c4eac589c77eb74a6bd6b3ec2
equestTest.java
RLConnectionTest.java
3281dee547ef61c7c792a6e2b94b4b66b0486376 16-Mar-2016 Neil Fuller <nfuller@google.com> Reapply an upstream OkHttp change to Android for HttpUrl

Manually reapplied change from upstream to address HttpUrl encoding issues.
This change did not apply cleanly. Upstream FormEncodingBuilder has
been refactored. Equivalent changes have been made.

Upstream details:
Comment:
Never throw converting an HttpUrl to a java.net.URI.

Just do arbitrary amounts of transformation. Sigh.

Closes https://github.com/square/okhttp/issues/2116
SHA: d77edcc8905148f18a691be180c4f8f366a5ee1b

Bug: 27590872
(cherry picked from commit 4c521731e582bbd36d1ef7276b25a347f91d9bbb)

Change-Id: I15317abbfcd6d7d4af3ce9793f61c912d9b66991
ttpUrlTest.java
cf7f0f3a1579c3a9127dd013420fca41546c842c 16-Mar-2016 Neil Fuller <nfuller@google.com> Reapply an upstream OkHttp change to Android for HttpUrl

Manually reapplied change from upstream to address HttpUrl encoding issues.

Upstream details:
Comment:
Don't percent-encode non-ASCII characters in fragments

Fixes https://github.com/square/okhttp/issues/1635
SHA: f4feb0adfcd8e209f90d4fffb6facf5c07f57110

Bug: 27590872
(cherry picked from commit 469258d7cc4690e91c3950020c4aea106f216b21)

Change-Id: I35e688e30d307a1c3f8b0d0b4ca18b799e28ab7d
ttpUrlTest.java
rlComponentEncodingTester.java
ebPlatformUrlTest.java
ca342d6c3c54ae2417d4e61c925ba6f63b31a571 01-Nov-2015 jwilson <jwilson@squareup.com> Apply upstream OkHttp HttpUrl fix

Upstream information:
Comment:
Encode enough to make URI happy.

Plus a bunch of test cases around this unfortunate case.

Closes https://github.com/square/okhttp/issues/1872
SHA: 080e7536ab8c2d07db58628f75a4140012e2a581

Bug: 27590872
(cherry picked from commit 6dde4fd274c15786415a313faf5b4506e3d712e4)

Change-Id: I8aab0e72639474d1ca2c6a2ca454e4a38e30bd84
ttpUrlTest.java
RLConnectionTest.java
rlComponentEncodingTester.java
27e75224b1285949154788db6d0c13ab383a6c82 31-Oct-2015 jwilson <jwilson@squareup.com> Apply upstream OkHttp HttpUrl fix

Upstream information:
Comment:
Handle null fragments.
SHA: e4dd6cfd63b251fba7a37e773f91c6bb4150b6bf

Bug: 27590872
(cherry picked from commit e31a2f4b1450d7d7a6b07b9ab9e3228c6a9083eb)

Change-Id: I1ddccb81c6f1cb482a580698ce92c311f1161374
ttpUrlTest.java
1eed816196c36bfe5f161f89fa7fca610708daf0 28-Sep-2015 Isaac Green <isaac@wink.com> Apply upstream OkHttp HttpUrl fix

Upstream information:
Comment:
use URI constructor for encoding fixes - https://github.com/square/okhttp/issues/1872
SHA: 2a13fe9d83a596ddbfe8299dc75ab33db9130d20

Bug: 27590872
(cherry picked from commit 49e7226eb85399e3bdd48a66dd898faaf1138b43)

Change-Id: Ic5e34b0b9b8c43931cb760e4f39c0af590e847c5
ttpUrlTest.java
RLConnectionTest.java
2a168a5cf9e08f207172aa0d3a8395a2b7b7434f 11-Mar-2016 Sergio Giro <sgiro@google.com> okhttp: add workaround in RequestTest for \r

Bug: 26422335
Bug: 26889631
Bug: 27606665
Change-Id: I88f5c0d456b871eccb36b49eb22e09065258ec02
equestTest.java
b77f9dbb5a5697695270da67fd29fff26e3e3cf2 08-Mar-2016 Sergio Giro <sgiro@google.com> Merge "Workaround for request header values with trailing '\r' or '\r\n'"
8ef2daccd20f80b439c93af7d7985fb26d1f6b2f 29-Feb-2016 Sergio Giro <sgiro@google.com> Workaround for request header values with trailing '\r' or '\r\n'

Testing is showing an app that appears to
be setting a request header with a trailing '\r'. This change
strips the '\r' or '\r\n' iff it is at the end of the value.

Bug: 26889631
Change-Id: I3a521a5272ad0c7cf3b018892516ced9e65f46ca
equestTest.java
cdf3c4bc9e853c99d82d4c1dfc907ef2694f2ed7 04-Feb-2016 Narayan Kamath <narayan@google.com> Temporary workaround for whatsapp issues.

Use the RFC-2732 specified hostname (for IPv6 literals) in places where it
makes sense to do so. We pass it to Socket factories / Authenticators and use
it in the request line as well.

bug: 26769689

Change-Id: I1102f143a887bd7a5fe1952336c162ecc7a01bc2
nterceptorTest.java
65f07bec4f480898b1c41472234b833497482829 20-Jan-2016 Narayan Kamath <narayan@google.com> Permit space to be encoded as + or %20.

(cherry-picked from commit 6d2dcf2cc543d15cad69d2873760f11037604c8f)

Note: Merged as pull request #1995 (https://github.com/square/okhttp/pull/1995)
Bug: 26455836

Change-Id: I1e3784f4624028edfd47ecc238f832b6dd7c0880
ormEncodingBuilderTest.java
ttpUrlTest.java
28c5794fc131ded439a3b3b0d959ee9e134ec3af 11-Jan-2016 Neil Fuller <nfuller@google.com> Workaround for request header values with trailing '\n'

Testing is showing a high-profile app that appears to
be setting a request header with a trailing '\n'. This change
strips the '\n' iff it is at the end of the value.

Bug: 26422335
Change-Id: Iaf63829574ce73f17b5ab75362144e95a00b4b26
equestTest.java
a51d868761c187255fdfaac767ca6a9c9345d4e8 16-Nov-2015 Neil Fuller <nfuller@google.com> Merge "Fix URLConnectionTest.writeTimeouts with large receive buffers"
d22dae2ff3c14d458829d7082651f3e6baa9b65d 09-Nov-2015 Neil Fuller <nfuller@google.com> Fix URLConnectionTest.writeTimeouts with large receive buffers

This is upstream okhttp commit 8b19bc471f66ee45c5eed3df6817411d074aabe5.
https://github.com/square/okhttp/commit/8b19bc471f66ee45c5eed3df6817411d074aabe5
back-ported to Android's version of OkHttp.

From the upstream commit:

The test relies on small client send / server receive buffers
to force blocking and generate a timeout.

The switch to make MockWebServer a @Rule (commit
785d9e94387f404f571775a49c3a9438508bb659) moved the
MockWebServer.start() call earlier in the test execution.
Setting the ServerSocketFactory became a no-op so the server
receive buffer size was left as the default.

The test became reliant on either:
1) The default server socket receive buffer being small enough
(e.g. less than the data being transmitted).
2) The device being too slow to send the requested data in the
time allowed.

The test was recently made less reliable by:
1) The okio commit
f30955cb15eb234f874dd55819686832c960765b, which made the segment
size bigger (increasing throughput / transfer efficiency).
2) The OkHttp commit f30955cb15eb234f874dd55819686832c960765b,
which reduced the amount of data being sent in the test from
16MB to 2MB.
3) Recent Android devices have large default buffer sizes. e.g.
Nexus 5: 1MB, Nexus 5X: 6MB.

Bug: 25459708
Change-Id: Icaa3255d86d228302931baca0432ea9a5be1e7f0
RLConnectionTest.java
92b46ba76cd8ad724b0f1dca9e457303f097bd41 27-Oct-2015 Neil Fuller <nfuller@google.com> Merge "Fix visibility of test method that prevents tests running"
am: 77cc4fcff2

* commit '77cc4fcff22577a963a309fa2cb24d51eb5cba08':
Fix visibility of test method that prevents tests running
c4c05ff9964ac8bca83bc751abe551f515ca499a 27-Oct-2015 Neil Fuller <nfuller@google.com> Fix visibility of test method that prevents tests running

Unfortunately, the version of the test committed was not the one
verified. This is a test-only change.

Bug: 25311563
Bug: 25138800
Change-Id: Id6ff0e1207e7962800290a1670de6e45f3b31e71
RLConnectionTest.java
8edcad68aceb442560b72e7720e4e2df97ac493c 23-Oct-2015 Neil Fuller <nfuller@google.com> Merge "Fix Http(s)URLConnectionImpl.getInstanceFollowsRedirects()"
am: c03aecac9b

* commit 'c03aecac9ba8a7acc0ec7258ab76ec6ee2e9d84b':
Fix Http(s)URLConnectionImpl.getInstanceFollowsRedirects()
ceafaf318f1176d96d18ed04355f76fa91a8e12b 20-Oct-2015 Neil Fuller <nfuller@google.com> Fix Http(s)URLConnectionImpl.getInstanceFollowsRedirects()

This is the proposed upstream PR:
https://github.com/square/okhttp/pull/1939

Bug: 25138800
Bug: https://code.google.com/p/android/issues/detail?id=190998
Change-Id: I3873cb59b8cd95aef2641d6b238ac65341eaba12
RLConnectionTest.java
1b4af3de8ef853d9ddcb38eaabe8da60b934a714 02-Oct-2015 Neil Fuller <nfuller@google.com> resolved conflicts for 14053454 to mnc-dr-dev-plus-aosp

Change-Id: I22b510a6192f70348f84c9ac17e8c7f28c2d6bd5
e0d02d710cd1bbcc1a9065ede7f6801f72abe5b7 30-Sep-2015 Neil Fuller <nfuller@google.com> Reduce the memory requirements of a test

Equivalent change to upstream pull request #1888.

URLConnectionTest.testWrites allocates a 16MB buffer.
It can run in less memory (and causes problems
on low-spec Android devices).

4k is the typical smallest allowable buffer size on
Linux.

Bug: 24403364
Change-Id: I81e60c89b2463e9131c4a76521f9baa2187cdbda
nternal/http/URLConnectionTest.java
36132b3cd2c814e057c775adc821ae0fb12aeb4c 27-Aug-2015 Neil Fuller <nfuller@google.com> Android modifications to OkHttp

Re-introduce Android integration classes and
make the modifications necessary to get OkHttp/Okio
to compile against Android.

The only Android-specific change made over prior versions
of this code is in Platform to remove the toURILenient()
method (no longer used by OkHttp).

This commit also includes pending PR
https://github.com/square/okhttp/pull/1858
to fix two tests on Android:
com.squareup.okhttp.URLConnectionTest#connectViaHttpsWithSSLFallback
com.squareup.okhttp.CallTest#recoverFromTlsHandshakeFailure_Async

Bug: 22943975
Bug: 23553256
Change-Id: I4c718c96fbd5fe3f2353ce422f8de3b95d0b75ee
elegatingSSLSocketFactory.java
ttpUrlTest.java
71b9f47b26fb57ac3e436a19519c6e3ec70e86eb 16-Sep-2015 Neil Fuller <nfuller@google.com> Pull latest code from upstream okhttp and okio

This change contains the OkHttp and Okio changes without
modification. The only additions are the
MODULE_LICENSE_APACHE2 files.

This corresponds closely to OkHttp 2.5.0 and
Okio 1.6.0. Behavior changes are documented in
CHANGELOG.md.

This change does not compile as is. The next
commit makes the Android modifications required.

okhttp: 4305dc3fabeab392eb56f2db51538e06c3a54e51
okio: 313436764bf35794e158c6171e319fee868298df

Change-Id: I97ce07ff0472cdbce09f588863a1e5ccdcea0c20
acheTest.java
allTest.java
ertificatePinnerTest.java
onnectionPoolTest.java
elegatingSSLSocketFactory.java
elegatingServerSocketFactory.java
elegatingSocketFactory.java
allbackTestClientSocketFactory.java
ormEncodingBuilderTest.java
ttpUrlTest.java
nterceptorTest.java
kHttpClientTest.java
ecordingCallback.java
equestTest.java
ocksProxyTest.java
estUtil.java
RLConnectionTest.java
rlComponentEncodingTester.java
ebPlatformTestRun.java
ebPlatformUrlTest.java
ebPlatformUrlTestData.java
nternal/ConnectionSpecSelectorTest.java
nternal/RecordingHostnameVerifier.java
nternal/framed/BaseTestHandler.java
nternal/framed/HpackTest.java
nternal/framed/Http2ConnectionTest.java
nternal/framed/Http2FrameLoggerTest.java
nternal/framed/Http2Test.java
nternal/framed/HuffmanTest.java
nternal/framed/MockSpdyPeer.java
nternal/framed/SettingsTest.java
nternal/framed/Spdy3ConnectionTest.java
nternal/framed/Spdy3Test.java
nternal/http/CookiesTest.java
nternal/http/DisconnectTest.java
nternal/http/HeadersTest.java
nternal/http/HttpOverSpdyTest.java
nternal/http/RouteExceptionTest.java
nternal/http/ThreadInterruptTest.java
nternal/http/URLConnectionTest.java
nternal/io/InMemoryFileSystem.java
nternal/spdy/BaseTestHandler.java
nternal/spdy/HpackTest.java
nternal/spdy/Http2ConnectionTest.java
nternal/spdy/Http2FrameLoggerTest.java
nternal/spdy/Http2Test.java
nternal/spdy/HuffmanTest.java
nternal/spdy/MockSpdyPeer.java
nternal/spdy/SettingsTest.java
nternal/spdy/Spdy3ConnectionTest.java
nternal/spdy/Spdy3Test.java
nternal/tls/HostnameVerifierTest.java
df2c498a3d4dc641c7b609873adf905848ace382 12-Jun-2015 Neil Fuller <nfuller@google.com> Apply upstream changes for timeout / pooled connection issue

This change contains two upstream commits:

Okio:

Upstream commit: a4aee7d9594a2eae48cd274163003e0566719b91

Author: jwilson <jwilson@squareup.com>
Date: Sat May 16 08:19:39 2015 -0400

Change Timeout.throwIfReached() to throw InterruptedIOException

Previously this was throwing IOException, but nothing was anticipated
that. This is slightly semantically incorrect; the thread wasn't
interrupted. But it's much more convenient to use a single exception
type for both timeouts.

Also add a new type, ForwardingTimeout.

OkHttp:

Upstream commit: 4df674f8c5e2c07d881b4f2780922c7d15940814

Author: jwilson <jwilson@squareup.com>
Date: Sat May 16 10:35:59 2015 -0400

Don't share timeouts between pooled connections.

This was causing crashes.

Closes https://github.com/square/okio/issues/133

Bug: 21799272
Change-Id: I6f38fa8aae7dfaa74361500b75ecd09f41eb1f91
allTest.java
54ee8648c06474ce612325e28bc0022b58925e1d 15-Jun-2015 Neil Fuller <nfuller@google.com> Merge "Apply upstream changes for timeout / pooled connection issue"
ed078614cd7c89aae39dce0615f8cbbf955b2a90 12-Jun-2015 Neil Fuller <nfuller@google.com> Apply upstream changes for timeout / pooled connection issue

This change contains two upstream commits:

Okio:

Upstream commit: a4aee7d9594a2eae48cd274163003e0566719b91

Author: jwilson <jwilson@squareup.com>
Date: Sat May 16 08:19:39 2015 -0400

Change Timeout.throwIfReached() to throw InterruptedIOException

Previously this was throwing IOException, but nothing was anticipated
that. This is slightly semantically incorrect; the thread wasn't
interrupted. But it's much more convenient to use a single exception
type for both timeouts.

Also add a new type, ForwardingTimeout.

OkHttp:

Upstream commit: 4df674f8c5e2c07d881b4f2780922c7d15940814

Author: jwilson <jwilson@squareup.com>
Date: Sat May 16 10:35:59 2015 -0400

Don't share timeouts between pooled connections.

This was causing crashes.

Closes https://github.com/square/okio/issues/133

Bug: 21799272
Change-Id: I6f38fa8aae7dfaa74361500b75ecd09f41eb1f91
allTest.java
ba6e9e96cd027a16f5f555966f332f8799da8b74 27-May-2015 Neil Fuller <nfuller@google.com> Fix for HttpURLConnection not always throwing SocketTimeoutException

Contains upstream changes:
Okio: https://github.com/square/okio/pull/154
OkHttp: https://github.com/square/okhttp/pull/1698 (pending)

Bug: 21396523
(cherry-picked from commit b5f9076b16fcc41c3dad31aecfdcfd962a7a1f75)

Change-Id: I4d44e973f906d41a622598e2293d4026fc1ed039
nternal/http/HttpOverSpdyTest.java
nternal/http/URLConnectionTest.java
b5f9076b16fcc41c3dad31aecfdcfd962a7a1f75 27-May-2015 Neil Fuller <nfuller@google.com> Fix for HttpURLConnection not always throwing SocketTimeoutException

Contains upstream changes:
Okio: https://github.com/square/okio/pull/154
OkHttp: https://github.com/square/okhttp/pull/1698 (pending)

Bug: 21396523
Change-Id: Ibe913cb8584331a470716272dcd42c088cbb975e
nternal/http/HttpOverSpdyTest.java
nternal/http/URLConnectionTest.java
e9689138ba98723f93ddf1bc74bbf66d332dfd76 19-May-2015 jwilson <jwilson@squareup.com> Fix flaky test Spdy3ConnectionTest.receiveGoAway().

Closes https://github.com/square/okhttp/issues/1660
(cherry-picked from upstream submit 7f6df401808d904d7065b4e83c8c4c4399079d8a)

Bug: 21212159
Change-Id: Iabb917e90076c851ed10fcac379298f2e6f6558c
nternal/spdy/Spdy3ConnectionTest.java
d6ed2ae912c016acf709fced5b66d542875deb7c 19-May-2015 jwilson <jwilson@squareup.com> Fix flaky test Spdy3ConnectionTest.receiveGoAway().

Closes https://github.com/square/okhttp/issues/1660
(cherry-picked from upstream submit 7f6df401808d904d7065b4e83c8c4c4399079d8a)

Bug: 21212159
Change-Id: Iabb917e90076c851ed10fcac379298f2e6f6558c
nternal/spdy/Spdy3ConnectionTest.java
781c9c216deed11c44044d23841a4ba6a012106e 07-May-2015 Neil Fuller <nfuller@google.com> Rollup of upstream OkHttp and Okio changes

OkHttp from: b5811711b141b230e4e58f577c79cfbf4c2d4028
to: 3c61fdb2ba9d1ebe0419b93cfbd4e94ffc857fe3

Okio from: b40f99a950cb407eff52537a97420bd253a64f63
to: b76b6903ef05546c5aef249ea6b2b679bc43094b

Both "to" are head as of 20150505.

Patches applied cleanly without conflicts except for
okio/okio/src/test/java/okio/BufferedSourceTest.java
which has local Android changes to account for Android
CTS only supporting Junit 4.10.

There are various changes included most of which will
not affect Android.

OkHttp changes of note for Android:

1) Improvements to TLS negotiation.
Upstream commit 60f5406dcc094d0431420139bd002e8bdd4ea5d5
https://github.com/square/okhttp/pull/1388

2) Fix for CTS tests on Android.
Upstream commit fb155c47661ede5da395dfb4e620867263b8c8e7
https://github.com/square/okhttp/pull/1555

3) Switch to using Okio for form URL encoding
Upstream commit 2a4c1f288d284d3266b5aec4decb167a3af0a976
https://github.com/square/okhttp/pull/1563

4) Fix Vary caching on Android.
Upstream commit b7baf23d86305762ea4e42adc4054c0840eca5ca
https://github.com/square/okhttp/pull/1590

5) Report some TLS issues during negotiation (not all)
Upstream commit 71ead1911be28c1cae1eef765abf23724b776981
https://github.com/square/okhttp/pull/1596

Okio changes of note for Android:

1) Fix for truncated GZIP streams
Upstream commit 3e25d85bc4ad3c6f1622b0438b3976804958fbfb
https://github.com/square/okhttp/issues/1540

Additional android-specific changes:

Suppress a new test that requires JUnit 4.11 and Gson in the
Android.mk file.

(cherry-picked from 7aeaaefc891f6221f4b2cce536b1c1e816e09794)
Bug: 20566983

Change-Id: Ib818478513ec712b1391b82e2376fc410eaaa737
allTest.java
onnectionPoolTest.java
onnectionSpecTest.java
ttpUrlTest.java
rlComponentEncodingTester.java
ebPlatformTestRun.java
ebPlatformUrlTest.java
ebPlatformUrlTestData.java
nternal/ConnectionSpecSelectorTest.java
nternal/http/RouteExceptionTest.java
nternal/http/RouteSelectorTest.java
nternal/http/URLConnectionTest.java
nternal/spdy/Spdy3ConnectionTest.java
7aeaaefc891f6221f4b2cce536b1c1e816e09794 07-May-2015 Neil Fuller <nfuller@google.com> Rollup of upstream OkHttp and Okio changes

OkHttp from: b5811711b141b230e4e58f577c79cfbf4c2d4028
to: 3c61fdb2ba9d1ebe0419b93cfbd4e94ffc857fe3

Okio from: b40f99a950cb407eff52537a97420bd253a64f63
to: b76b6903ef05546c5aef249ea6b2b679bc43094b

Both "to" are head as of 20150505.

Patches applied cleanly without conflicts except for
okio/okio/src/test/java/okio/BufferedSourceTest.java
which has local Android changes to account for Android
CTS only supporting Junit 4.10.

There are various changes included most of which will
not affect Android.

OkHttp changes of note for Android:

1) Improvements to TLS negotiation.
Upstream commit 60f5406dcc094d0431420139bd002e8bdd4ea5d5
https://github.com/square/okhttp/pull/1388

2) Fix for CTS tests on Android.
Upstream commit fb155c47661ede5da395dfb4e620867263b8c8e7
https://github.com/square/okhttp/pull/1555

3) Switch to using Okio for form URL encoding
Upstream commit 2a4c1f288d284d3266b5aec4decb167a3af0a976
https://github.com/square/okhttp/pull/1563

4) Fix Vary caching on Android.
Upstream commit b7baf23d86305762ea4e42adc4054c0840eca5ca
https://github.com/square/okhttp/pull/1590

5) Report some TLS issues during negotiation (not all)
Upstream commit 71ead1911be28c1cae1eef765abf23724b776981
https://github.com/square/okhttp/pull/1596

Okio changes of note for Android:

1) Fix for truncated GZIP streams
Upstream commit 3e25d85bc4ad3c6f1622b0438b3976804958fbfb
https://github.com/square/okhttp/issues/1540

Additional android-specific changes:

Suppress a new test that requires JUnit 4.11 and Gson in the
Android.mk file.

Change-Id: I98ed1cc1debf7e03c5895bec38ea5cf9e402b144
allTest.java
onnectionPoolTest.java
onnectionSpecTest.java
ttpUrlTest.java
rlComponentEncodingTester.java
ebPlatformTestRun.java
ebPlatformUrlTest.java
ebPlatformUrlTestData.java
nternal/ConnectionSpecSelectorTest.java
nternal/http/RouteExceptionTest.java
nternal/http/RouteSelectorTest.java
nternal/http/URLConnectionTest.java
nternal/spdy/Spdy3ConnectionTest.java
a2cab72aa5ff730ba2ae987b45398faafffeb505 13-Apr-2015 Neil Fuller <nfuller@google.com> Roll-up of upstream OkHttp and Okio changes

OkHttp:
From b609edd07864d7191dcda8ba1f6c833c9fe170ad
to b40f99a950cb407eff52537a97420bd253a64f63

Okio:
From 654ddf5e8f6311fda77e429c22d5e0e15f713b8d
to b5811711b141b230e4e58f577c79cfbf4c2d4028

Both "to" are head as of 20150413.

Patches applied cleanly without conflicts.

This submission will break some CTS tests due
to https://github.com/square/okhttp/issues/1552
Solutions will be made upstream and patched in.
The CTS tests broken are related to SPDY/HTTP2
which are not used by Android's embedded OkHttp.

Change-Id: I84d55b6f5c8dbc05148e86bd9421a2c393b563d4
allTest.java
nterceptorTest.java
ultipartBuilderTest.java
kHttpClientTest.java
ecordedResponse.java
equestTest.java
nternal/DiskLruCacheTest.java
nternal/FaultyFileSystem.java
nternal/http/HttpOverHttp20Draft16Test.java
nternal/http/HttpOverHttp2Test.java
nternal/http/URLConnectionTest.java
nternal/io/InMemoryFileSystem.java
nternal/spdy/HpackDraft10Test.java
nternal/spdy/HpackTest.java
nternal/spdy/Http20Draft16FrameLoggerTest.java
nternal/spdy/Http20Draft16Test.java
nternal/spdy/Http2ConnectionTest.java
nternal/spdy/Http2FrameLoggerTest.java
nternal/spdy/Http2Test.java
nternal/spdy/MockSpdyPeer.java
nternal/spdy/Spdy3ConnectionTest.java
nternal/ws/RealWebSocketTest.java
nternal/ws/WebSocketCallTest.java
nternal/ws/WebSocketReaderTest.java
nternal/ws/WebSocketRecorder.java
nternal/ws/WebSocketWriterTest.java
63e93d451c2745eb007436e15a40d3797104cd9a 12-Feb-2015 Neil Fuller <nfuller@google.com> am b3ed2930: Merge "A rollup of recent upstream commits for OkHttp"

* commit 'b3ed2930c906377ff193b5fd1546b7e8122f52c4':
A rollup of recent upstream commits for OkHttp
3be78b8b0ca13d9e05e2327acb8d8654f719a3f6 11-Feb-2015 Neil Fuller <nfuller@google.com> A rollup of recent upstream commits for OkHttp

squareup/okhttp commits from:
0a197466608681593cc9be9487965a0b1d5c244c
to:
b609edd07864d7191dcda8ba1f6c833c9fe170ad

squareup/okio commits from:
654ddf5e8f6311fda77e429c22d5e0e15f713b8d
to
82358df7f09e18aa42348836c614212085bbf045

Changes that might affect Android:
1) Cache control request headers: If-None-Match
or If-Modified-Since sent, never both.
2) Make okhttp behave more like a private, not a
shared cache.
3) SSLPeerUnverifiedException now thrown on
hostname verification errors, not IOException.

Change-Id: I3a2e8ae9bebfec84eaf8eb2aaa70085fa40fadd5
acheControlTest.java
acheTest.java
onnectionSpecTest.java
nterceptorTest.java
kHttpClientTest.java
74a968d084559e865f62a5a53fb27b5b91ba834d 09-Feb-2015 Neil Fuller <nfuller@google.com> am 75a7afac: Reduce flakiness of OkHttp tests

* commit '75a7afac9b6b5866cde46c3d3158227391175701':
Reduce flakiness of OkHttp tests
75a7afac9b6b5866cde46c3d3158227391175701 09-Feb-2015 Neil Fuller <nfuller@google.com> Reduce flakiness of OkHttp tests

Copy of the test changes from a pending upstream
pull-request:
https://github.com/square/okhttp/pull/1348

----

Android has been receiving reports of some tests being flaky
on what are probably lower-spec devices.

This introduces delays into tests where sockets are being
poisoned after the entire response body has been written to
them *and* where there are follow-up requests.

Bug: 18953235
Change-Id: Ic2d281a3faad6082819ef6d57b3489bcd6dbd474
nternal/http/URLConnectionTest.java
1af6ab72ebdbea43f878ba00d80f20bec2643b50 20-Jan-2015 Neil Fuller <nfuller@google.com> am e1c47bc5: Merge "Pull latest OkHttp code from upstream"

* commit 'e1c47bc54f7c464f10a6acd1f81fcc84477be39c':
Pull latest OkHttp code from upstream
e78f117bcbd6b57d783737107f445ef75ecb474a 20-Jan-2015 Neil Fuller <nfuller@google.com> Pull latest OkHttp code from upstream

okio:

okio is now managed upstream as a separate project but has
been included here as a sub directory: the okio version here
is intended only for use with OkHttp.
okio is synced to upstream commit
82358df7f09e18aa42348836c614212085bbf045.
See okio/README.android for local changed needed to make it
compile.

okhttp:

This is effectively an upgrade from a snapshot close to
OkHttp 1.5 with Android additions to a snapshot close to
OkHttp 2.2.
okhttp was synced to upstream commit
0a197466608681593cc9be9487965a0b1d5c244c
See README.android for local changes needed to make it
compile.

Most of the old Android changes have been pushed upstream
and other upstream changes have been made to keep OkHttp
working on Android.

TLS fallback changes have not been upstreamed yet:
bcce0a3d26d66d33beb742ae2adddb3b7db5ad08
ede2bf1af0917482da8ccb7b048130592034253d

This means that some CTS tests will start to fail. A later
commit will fix those changes when it has been accepted
upstream.

There are associated changes in libcore and frameworks/base.

Change-Id: I0a68b27b1ec7067be452671bc591edfd84e310f2
ddressTest.java
syncApiTest.java
acheControlTest.java
acheTest.java
allTest.java
ertificatePinnerTest.java
onnectionPoolTest.java
onnectionSpecTest.java
elegatingSSLSocket.java
elegatingSSLSocketFactory.java
elegatingServerSocketFactory.java
elegatingSocketFactory.java
ispatcherTest.java
allbackTestClientSocketFactory.java
ormEncodingBuilderTest.java
nterceptorTest.java
imitedProtocolsSocketFactory.java
ediaTypeTest.java
ultipartBuilderTest.java
kHttpClientTest.java
ecordedResponse.java
ecordingCallback.java
ecordingReceiver.java
equestTest.java
ocksProxy.java
ocksProxyTest.java
yncApiTest.java
estLogHandler.java
estUtil.java
nternal/BitArrayTest.java
nternal/DiskLruCacheTest.java
nternal/DoubleInetAddressNetwork.java
nternal/OptionalMethodTest.java
nternal/RecordingAuthenticator.java
nternal/RecordingHostnameVerifier.java
nternal/RecordingOkAuthenticator.java
nternal/SingleInetAddressNetwork.java
nternal/TlsConfigurationTest.java
nternal/TlsFallbackStrategyTest.java
nternal/http/CookiesTest.java
nternal/http/DisconnectTest.java
nternal/http/ExternalHttp2Example.java
nternal/http/ExternalSpdyExample.java
nternal/http/HeadersTest.java
nternal/http/HttpOverHttp20Draft09Test.java
nternal/http/HttpOverHttp20Draft16Test.java
nternal/http/HttpOverSpdyTest.java
nternal/http/HttpResponseCacheTest.java
nternal/http/JavaApiConverterTest.java
nternal/http/RecordingProxySelector.java
nternal/http/ResponseCacheAdapterTest.java
nternal/http/ResponseCacheTest.java
nternal/http/RouteSelectorTest.java
nternal/http/StatusLineTest.java
nternal/http/ThreadInterruptTest.java
nternal/http/URLConnectionTest.java
nternal/http/URLEncodingTest.java
nternal/spdy/BaseTestHandler.java
nternal/spdy/HpackDraft05Test.java
nternal/spdy/HpackDraft10Test.java
nternal/spdy/Http20Draft09Test.java
nternal/spdy/Http20Draft16FrameLoggerTest.java
nternal/spdy/Http20Draft16Test.java
nternal/spdy/Http2ConnectionTest.java
nternal/spdy/HuffmanTest.java
nternal/spdy/MockSpdyPeer.java
nternal/spdy/SettingsTest.java
nternal/spdy/Spdy3ConnectionTest.java
nternal/spdy/Spdy3Test.java
nternal/spdy/SpdyConnectionTest.java
nternal/ws/RealWebSocketTest.java
nternal/ws/WebSocketCallTest.java
nternal/ws/WebSocketReaderTest.java
nternal/ws/WebSocketRecorder.java
nternal/ws/WebSocketWriterTest.java
48c97b470852bf5aa510cfc5f09b39014b5429c4 12-Dec-2014 Neil Fuller <nfuller@google.com> am 342d21a7: Fix DisconnectTest for devices with large socket buffers

* commit '342d21a7eb7d28ae132c43a4ab8353cbedff9e01':
Fix DisconnectTest for devices with large socket buffers
342d21a7eb7d28ae132c43a4ab8353cbedff9e01 11-Dec-2014 Neil Fuller <nfuller@google.com> Fix DisconnectTest for devices with large socket buffers

Similar to commit e3bfefb13c93006a2fbe22363572a314f6c18659
but for DisconnectTest. The buffer sizes are large on some
devices so the expectation that they take a lot of time to
stream data is invalid because they just write into the
buffers.

Bug: 18703696
Change-Id: I6127b044bf7fefc192f577d0b035deacbc54dd5f
nternal/http/DisconnectTest.java
dd6543e08d4d139de53b51753ceb2dffea93beac 10-Dec-2014 Neil Fuller <nfuller@google.com> Merge "Avoid a reverse DNS-lookup for a numeric proxy address" into lmp-mr1-dev
2ed0095a4f0da2f0bbe75b9d139419ce75afaa25 02-Dec-2014 Neil Fuller <nfuller@google.com> Avoid a reverse DNS-lookup for a numeric proxy address

When the proxy is specified as an IP address the RouteSelector
would force a reverse-lookup. This can introduce extra latency
when the DNS is slow or missing. It also then turns the name
back into a set of IPs, which may result in the original IP
address not being given priority.

This is upstream commit:
https://github.com/square/okhttp/commit/9acd5e7b54fb55f62a5dd16865c30787dfba4c8b

Bug: 18567569
Bug: 18327075
(cherry picked from commit 797fdc6cc6bf16372e9464f189b535148f944ce9)

Change-Id: I52b4049095acafd2367530532d8cad7d75b6809a
nternal/http/RouteSelectorTest.java
8d3b26005b3e3e8bf89a6f5bd2ba959a1c0e9fc6 09-Dec-2014 Neil Fuller <nfuller@google.com> am 29bc9ccd: Merge "Avoid a reverse DNS-lookup for a numeric proxy address"

* commit '29bc9ccd7b93087132b50e8154d0ee5bff0cac12':
Avoid a reverse DNS-lookup for a numeric proxy address
29bc9ccd7b93087132b50e8154d0ee5bff0cac12 08-Dec-2014 Neil Fuller <nfuller@google.com> Merge "Avoid a reverse DNS-lookup for a numeric proxy address"
e06cad937461843e922d0f270402c969457badb6 04-Dec-2014 Alex Klyubin <klyubin@google.com> resolved conflicts for merge of 51f523b9 to lmp-mr1-dev-plus-aosp

Change-Id: I6408a8ed19f3d676d1b0da3e4f7f29541b5d4dc8
797fdc6cc6bf16372e9464f189b535148f944ce9 02-Dec-2014 Neil Fuller <nfuller@google.com> Avoid a reverse DNS-lookup for a numeric proxy address

When the proxy is specified as an IP address the RouteSelector
would force a reverse-lookup. This can introduce extra latency
when the DNS is slow or missing. It also then turns the name
back into a set of IPs, which may result in the original IP
address not being given priority.

This is upstream commit:
https://github.com/square/okhttp/commit/9acd5e7b54fb55f62a5dd16865c30787dfba4c8b

Bug: 18327075
Change-Id: Idafd72f4d5b901e267081f924377db4ada9afe1b
nternal/http/RouteSelectorTest.java
57592013ea5a8d2aeb9842aa6e463d89fa6fa250 02-Dec-2014 Alex Klyubin <klyubin@google.com> Strict, modern HostnameVerifier.

This brings OkHostnameVerifier up to date with the intersection of
RFC 2818 and Baseline Requirements, and adds support for absolute
domain names.

The changes are:
* Absolute domain names are supported. All presented hostnames are
treated as absolute domain names. All domain names in server
certificates are treated as absolute domain names as well.
* Wildcard character (*) is permitted only in the left-most domain
name label and must be the only character in that label. For
example, *.example.com is permitted, while *a.example.com,
a*.example.com, a*b.example.com, a.*.example.com are not permitted.
* Wildcard character (*) must match exactly one domain name label.
For example, *.example.com matches www.example.com, but does not
match example.com or www.test.example.com.
* Wildcard pattern cannot mach single-label domain names: * and *.
patterns are rejected.

Bug: 18432707
Bug: 17482685
Bug: 17548724
Bug: 17552202
Bug: 17552202
Change-Id: I560121f388568d0513a0cee22250b6fc59424b30
nternal/tls/HostnameVerifierTest.java
afcb40207ecf7fc935b40a76cd0c039d5e576441 02-Dec-2014 Neil Fuller <nfuller@google.com> am 0f102f51: Add further handling for when a CONNECT incorrectly returns a body.

* commit '0f102f51711ecc2ef9f25cbbad2148ee97bdb6cb':
Add further handling for when a CONNECT incorrectly returns a body.
0f102f51711ecc2ef9f25cbbad2148ee97bdb6cb 05-Nov-2014 Neil Fuller <nfuller@google.com> Add further handling for when a CONNECT incorrectly returns a body.

Before the change:
If a proxy returns a body and some of the body bytes have
already been buffered then an IOException is thrown.
If the body bytes have not been buffered then the handshake will
fail due to the presence of bytes where the Server HELLO is
expected, typically with some kind of SSLHandshakeException.

After the change:
The body bytes are consumed to ensure consistent behavior. The
handshake will then take place.

History:
This is an unusual case that would occasionally cause failures
on Android when a ResponseCache was installed. Android introduced
a patch to prevent CONNECT responses being cached. Since then,
OkHttp has changed the code and probably fixed the issue via
other means. The Android test remained and would sometimes
experience one exception, sometimes another, depending on the
state of the buffer.

If the presence of a body is a possibility it would be nice
to deal with it consistently and deterministically.

The motivation for this change is to make an Android test
equivalent to the one added here behave consistently and in a
way that doesn't involve connection fallback.

The only risk with this change is if a proxy is incorrectly
reporting the content length: this might lead to blocking on
the body read/skip (as OkHttp would probably do elsewhere if a
server mis-reports a content-length). This may make connections
to "bad" proxies slightly more reliable.

Bug: 6754912
Bug: 18575971

(cherry picked from commit 007b88ad6df622a2e5daacce604637d006ed6212)

Change-Id: Icf9e17a26dd2b1c4024935dfae3e87b2654a220e
nternal/http/URLConnectionTest.java
f2398723f7501e92147e46496b50d7eb2b9d5baf 24-Nov-2014 Neil Fuller <nfuller@google.com> am 442180cd: Merge "Switch over to a new TLS fallback strategy"

* commit '442180cdae6a99817e98724901cb5f5263025e64':
Switch over to a new TLS fallback strategy
ce980428e3b4c498376aa8bddaf112fd34ebfdf8 21-Nov-2014 Neil Fuller <nfuller@google.com> am 80a1db28: Merge "Changes for dealing with more granular TLS connection fallback"

* commit '80a1db2828f1a1ae290a6cc8105616666fa97e73':
Changes for dealing with more granular TLS connection fallback
ede2bf1af0917482da8ccb7b048130592034253d 29-Oct-2014 Neil Fuller <nfuller@google.com> Switch over to a new TLS fallback strategy

TLSv1.2 -> TLSv1.1 -> TLSv1 -> SSLv3

Connection attempts for each protocol (along with all lower
protocols) are tried only if they are enabled on the socket.

Bug: 13228108
Change-Id: I52ecd17c40996b30751fbeee6c3221c176df36e5
nternal/TlsConfigurationTest.java
nternal/TlsFallbackStrategyTest.java
9bc151d6ba29a84e87a5755ebdba9a9c95c9bebe 20-Nov-2014 Neil Fuller <nfuller@google.com> am fcc9fffc: Merge "Improve tests for TLS fallback."

* commit 'fcc9fffc119d3ecb6482c04875eec2e6e0378c88':
Improve tests for TLS fallback.
bcce0a3d26d66d33beb742ae2adddb3b7db5ad08 28-Oct-2014 Neil Fuller <nfuller@google.com> Changes for dealing with more granular TLS connection fallback

This change also enabled OkHttp to handle socket factories that
produce sockets that do not not enable all the protocols that might
be part of the fallback strategy. e.g. to avoid enabling SSLv3 when
SSLv3 is not enabled by default.

If a socket is encountered that does not support, e.g., TLSv1.2 the
negotiation is not attempted or failed; the strategy simply falls
back until it finds a TlsConfiguration that can work. If none will
work an exception is thrown.

The majority of this change is dealing with the fact that it is not
easy to know in advance which TLS/SSL protocol versions are supported
by a socket without having a socket instance. OkHttp currently
assumes that TLS configuration can be predetermined.

RouteSelector no longer deals with TLS fallback. This is now handled
by the Connection instead.

A later CL will modify the fallback strategy to try various TLS
versions (when supported) instead of switching immediately to SSLv3.
This change allows Android to switch with minimal code changes, at
least until we take a newer version of OkHttp where it may be easier.

Bug: 13228108
Change-Id: If76b0b5699c22601f21c9afe494d7089ac2fa55c
syncApiTest.java
onnectionPoolTest.java
yncApiTest.java
nternal/TlsConfigurationTest.java
nternal/TlsFallbackStrategyTest.java
nternal/http/RouteSelectorTest.java
nternal/http/URLConnectionTest.java
00407a766d802a365a2025add7ce89be46548da4 20-Nov-2014 Neil Fuller <nfuller@google.com> Merge "Fix for a socket leak in OkHttp on Android" into lmp-mr1-dev
20cce1f8972a011495abfe95375b8406184f9c9b 20-Nov-2014 Neil Fuller <nfuller@google.com> am 08d4640f: Merge "Fix for a socket leak in OkHttp on Android"

* commit '08d4640fac88f5e18eefec1992745535b26210b6':
Fix for a socket leak in OkHttp on Android
d7254e38efa2f20db6cac1a5cb5ac4548edc3d46 06-Nov-2014 Neil Fuller <nfuller@google.com> Improve tests for TLS fallback.

This is a small improvement over the changes that were submitted to
Android when TLS_FALLBACK_SCSV was introduced.

Previously the tests would cripple the server to use a low quality
protocol so the TLS_FALLBACK_SCSV check would pass for all connection
attempts.

Some tests for APIs not used in Android were suppressed.

This change modifies that approach. Instead it:

1) Introduces a test client socket factory that ignores any attempt
to set the TLS_FALLBACK_SCSV cipher. This means that the server will
not attempt to enforce the fallback check.
2) Pulls out some test infrastructure for use across tests.
3) Re-enables / modifies the tests that were suppressed.

The ideal solution would be to disable TLS_FALLBACK_SCSV checks in
the MockWebServer for the tests that are supposed to simulate servers
that do not perform TLS_FALLBACK_SCSV checks. However, we do not
currently have a mechanism to do this.

This change also adjusts tests that test fallback to explicitly
enable SSLv3 for server-side socket factories. The Android default
was changed to disable SSLv3 (though it is still supported). An
up-coming change should remove the need for this.

Change-Id: Ib4a57bc106928c0dd0653376341527fba7a8a00c
syncApiTest.java
elegatingSSLSocket.java
elegatingSSLSocketFactory.java
allbackTestClientSocketFactory.java
imitedProtocolsSocketFactory.java
yncApiTest.java
nternal/http/URLConnectionTest.java
f3bcd0c7f0741b277b5d58f294df6201dafd45e8 19-Nov-2014 Neil Fuller <nfuller@google.com> Fix for a socket leak in OkHttp on Android

When the preferred Android network changes from
cell -> wifi or wifi -> cell the HTTP connection
pool in use is abandoned to avoid reuse of
connections on the old network. This was added
in commit 8bced3e.

The design for the connection pool was such that
continuous use of the connection pool was required to
clean up idle / expired connections. If a connection
pool becomes idle (as when it is dereferenced on a
network change) it is possible for some connections
to remain in the pool indefinitely.

After the preferred network change, because the old
connection pool was no longer referenced the pool
would be garbage collected and Android's "Strict Mode"
would complain about sockets not being closed.

The only existing way to avoid this was to call
"evictAll()", which would have had issues when a
large number of connections were returned to the pool
after evictAll() was called. It also wouldn't work
for SPDY connections which are shared but not reference
counted, which makes knowing whether it is safe to
close them difficult. SPDY is not enabled on Android
by default and so that may have been safe to ignore.

This fix tries to keep the existing cleaning behavior
intact to avoid introducing new bugs or new thread
behavior that might impact battery life. It adds a
new mode to the pool for "draining", which handles
cleaning up any existing entries in the pool and any
added after the pool has been placed into draining
mode.

The drainModeRunnable introduced serves two purposes:

1) While scheduled / executing, it pins the connection
pool in memory to avoid it being garbage collected.
2) It continues to close connections (safely) until the
pool is empty.

If a connection is then added back to the pool the
drainModeRunnable is restarted.

Bug: 18369687
(cherry picked from commit ff345b6c0ffcc691e4c3c594f8a222cf81bb325c)

Change-Id: I4e9e530f8e7acedf4b9a806237c8769a10671feb
onnectionPoolTest.java
ff345b6c0ffcc691e4c3c594f8a222cf81bb325c 19-Nov-2014 Neil Fuller <nfuller@google.com> Fix for a socket leak in OkHttp on Android

When the preferred Android network changes from
cell -> wifi or wifi -> cell the HTTP connection
pool in use is abandoned to avoid reuse of
connections on the old network. This was added
in commit 8bced3e.

The design for the connection pool was such that
continuous use of the connection pool was required to
clean up idle / expired connections. If a connection
pool becomes idle (as when it is dereferenced on a
network change) it is possible for some connections
to remain in the pool indefinitely.

After the preferred network change, because the old
connection pool was no longer referenced the pool
would be garbage collected and Android's "Strict Mode"
would complain about sockets not being closed.

The only existing way to avoid this was to call
"evictAll()", which would have had issues when a
large number of connections were returned to the pool
after evictAll() was called. It also wouldn't work
for SPDY connections which are shared but not reference
counted, which makes knowing whether it is safe to
close them difficult. SPDY is not enabled on Android
by default and so that may have been safe to ignore.

This fix tries to keep the existing cleaning behavior
intact to avoid introducing new bugs or new thread
behavior that might impact battery life. It adds a
new mode to the pool for "draining", which handles
cleaning up any existing entries in the pool and any
added after the pool has been placed into draining
mode.

The drainModeRunnable introduced serves two purposes:

1) While scheduled / executing, it pins the connection
pool in memory to avoid it being garbage collected.
2) It continues to close connections (safely) until the
pool is empty.

If a connection is then added back to the pool the
drainModeRunnable is restarted.

Bug: 18369687
Change-Id: I7e9bdd0edba84784f667105f52ef80655c1b06ff
onnectionPoolTest.java
466ef072d672d6c5cce3da222f76828427680e53 19-Nov-2014 Alex Klyubin <klyubin@google.com> am db7edbf1: am 200d28a2: am e82a7960: Fix a bug in OkHostnameVerifier wildcard handling.

* commit 'db7edbf1f7713d5170a8132c0d1a3c43f90f55e5':
Fix a bug in OkHostnameVerifier wildcard handling.
f13329c9b228c96d5e38f0a686cc1d0366bbea86 19-Nov-2014 Alex Klyubin <klyubin@google.com> am a03ec4ce: Fix a bug in OkHostnameVerifier wildcard handling.

* commit 'a03ec4ced2b11f9eae6cbeeedb1db2b1b29fafb1':
Fix a bug in OkHostnameVerifier wildcard handling.
a03ec4ced2b11f9eae6cbeeedb1db2b1b29fafb1 19-Nov-2014 Alex Klyubin <klyubin@google.com> Fix a bug in OkHostnameVerifier wildcard handling.

Wildcard domain name patterns of the form *.remainder are supposed to
match domain names that exactly match the remainder. Due to a bug,
the match was not exact but rather a prefix match: domain names
starting with the remainder would match too.

This CL fixes the issue.

Bug: 18432707
Change-Id: I2639ff51cabcbd395d4f30a9c69f9895738e0acf
nternal/tls/HostnameVerifierTest.java
007b88ad6df622a2e5daacce604637d006ed6212 05-Nov-2014 Neil Fuller <nfuller@google.com> Add further handling for when a CONNECT incorrectly returns a body.

Before the change:
If a proxy returns a body and some of the body bytes have
already been buffered then an IOException is thrown.
If the body bytes have not been buffered then the handshake will
fail due to the presence of bytes where the Server HELLO is
expected, typically with some kind of SSLHandshakeException.

After the change:
The body bytes are consumed to ensure consistent behavior. The
handshake will then take place.

History:
This is an unusual case that would occasionally cause failures
on Android when a ResponseCache was installed. Android introduced
a patch to prevent CONNECT responses being cached. Since then,
OkHttp has changed the code and probably fixed the issue via
other means. The Android test remained and would sometimes
experience one exception, sometimes another, depending on the
state of the buffer.

If the presence of a body is a possibility it would be nice
to deal with it consistently and deterministically.

The motivation for this change is to make an Android test
equivalent to the one added here behave consistently and in a
way that doesn't involve connection fallback.

The only risk with this change is if a proxy is incorrectly
reporting the content length: this might lead to blocking on
the body read/skip (as OkHttp would probably do elsewhere if a
server mis-reports a content-length). This may make connections
to "bad" proxies slightly more reliable.

Bug: 6754912
Change-Id: I36fff6633b3716e43347ade4e0a175134fb525f9
nternal/http/URLConnectionTest.java
602d5e4cfdbd0bad91e7872837f95aff5b461595 03-Apr-2014 Jesse Wilson <jwilson@squareup.com> New disconnect strategy.

Support asynchronous disconnects by breaking the socket only, which
should cause the thread using that socket to trigger clean-up.

Upstream commit: https://github.com/square/okhttp/commit/9c302131491d05a4ca0209ef21770592c01f76fa

Bug: 18083851
(cherry picked from commit 87ed7244fb53ae2bac9f23c033bbd5f23ac269f8)

Change-Id: Ia16147cb84eb9e73af48a2771ef734fbb7baa8f5
nternal/http/DisconnectTest.java
nternal/http/URLConnectionTest.java
87ed7244fb53ae2bac9f23c033bbd5f23ac269f8 03-Apr-2014 Jesse Wilson <jwilson@squareup.com> New disconnect strategy.

Support asynchronous disconnects by breaking the socket only, which
should cause the thread using that socket to trigger clean-up.

Upstream commit: https://github.com/square/okhttp/commit/9c302131491d05a4ca0209ef21770592c01f76fa

Bug: 18083851
Change-Id: I5f5eb648f4a5f2022c63acd7c903aac88e178d9a
nternal/http/DisconnectTest.java
nternal/http/URLConnectionTest.java
06000437514dd60aa19a00187c5a606202a7a035 13-Oct-2014 Neil Fuller <nfuller@google.com> Fixing broken OkHttp CTS test

Bug: 17962997
Bug: 17750026
(cherry picked from commit 95d1a1316ee04d39d55102e65daaacb97f5d42f8)

Change-Id: I75caa1d9a19b402b050b9230df58c67bd1b107dd
nternal/http/URLConnectionTest.java
80dc43a961235f35dd6859e6375c84825a5986e0 06-Oct-2014 Neil Fuller <nfuller@google.com> Fix OkHttp test failure for fast devices

On a fast device the ThreadInterruptTest#interruptWritingRequestBody
would consistently fail.

The issue is probably a combination of socket buffering and the data
volume chosen by the test. The test was written to assume that
read-side throttling would prevent the writer from writing its data
within 500 millis. After ~500 millis the write thread would be
interrupted and the test would pass.

On a fast device the test would write all the test data
in ~ 125 millis and the test would fail. The interruption would then
trigger on a later test
(typically URLConnectionTest#authenticateWithGetAndTransparentGzip),
breaking that test as well.

If there is sufficient socket-level read/write buffering it is
possible the data being written will just fill the socket buffers
and the writer will terminate early. If the data to be written is
increased from 2 to 10 MB the test passes.

Bug: 17516838
(cherry-picked from commit e3bfefb13c93006a2fbe22363572a314f6c18659)

Change-Id: Id832c366611d19a0e771b5dfb58a716b17221f95
nternal/http/ThreadInterruptTest.java
95d1a1316ee04d39d55102e65daaacb97f5d42f8 13-Oct-2014 Neil Fuller <nfuller@google.com> Fixing broken OkHttp CTS test

Bug: 17962997
Bug: 17750026
Change-Id: Icbc48a8c30857b3afb0175ac4b341626d4b3dfe8
nternal/http/URLConnectionTest.java
e3bfefb13c93006a2fbe22363572a314f6c18659 06-Oct-2014 Neil Fuller <nfuller@google.com> Fix OkHttp test failure for fast devices

On a fast device the ThreadInterruptTest#interruptWritingRequestBody
would consistently fail.

The issue is probably a combination of socket buffering and the data
volume chosen by the test. The test was written to assume that
read-side throttling would prevent the writer from writing its data
within 500 millis. After ~500 millis the write thread would be
interrupted and the test would pass.

On a fast device the test would write all the test data
in ~ 125 millis and the test would fail. The interruption would then
trigger on a later test
(typically URLConnectionTest#authenticateWithGetAndTransparentGzip),
breaking that test as well.

If there is sufficient socket-level read/write buffering it is
possible the data being written will just fill the socket buffers
and the writer will terminate early. If the data to be written is
increased from 2 to 10 MB the test passes.

Bug: 17516838
Change-Id: I54b5de9527d9737e6c987b6a9c4f62578f4f8fb7
nternal/http/ThreadInterruptTest.java
807414ac6a58b2a4227b9511e630479370923e25 06-Aug-2014 Neil Fuller <nfuller@google.com> Fix knock-ons from upstream okhttp pull #1011

Commit 5093c4f8bd7be79d7c7cd3e00945190105ed9aab
broke ResponseCacheTest. The test was asserting a string
using a copy of the old broken implementation.

The test now just uses HttpDate, which now has its own
tests.

This test fix will pushed upstream to OkHttp.

Change-Id: Ie298ef660d9355f46df05523bb7945dfa0b15034
nternal/http/ResponseCacheTest.java
5093c4f8bd7be79d7c7cd3e00945190105ed9aab 31-Jul-2014 Neil Fuller <nfuller@google.com> Apply okhttp upstream pull request #1011

Fix formatting / parsing for Android

Ensuring that this Android bug is fixed for the next
Android release:
https://code.google.com/p/android/issues/detail?id=66135

On Android the SimpleDateFormat for "zzz" returns GMT+00:00.
This is regrettable but awkward to change as it is existing
behavior.
https://code.google.com/p/android/issues/detail?id=66136

This change fixes the format to 'GMT'.

This change also fixes a bug where the platform default
timezone was used for parsing some date/times and not GMT.

Various tests have been added to prove the behavior when
timezones are missing and dates are malformed.

(cherry picked from okhttp b36761b7dd5a0743ec5d89fb9adc36b602cc3b4b)
Bug: https://code.google.com/p/android/issues/detail?id=66135
Change-Id: I831693bfff884c5d70f8592b47effd368a369859
nternal/http/HttpDateTest.java
2ee29995b7bd1068991884a54ca14e9aeeff1a58 30-Jul-2014 Neil Fuller <nfuller@google.com> Fix transparent gzip for basic auth.

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

Thanks to mattpan91 for the report.

The issue was fixed in OkHttp 2.0. It has now been back-ported to 1.6.

This is a cherry pick from the okhttp_16 branch:
https://github.com/square/okhttp/commit/e8fee51087a062384f52e11400ff4a104a00a2b2

The merge was not entirely straightforward: Android is currently not quite
on 1.6; it is close and it was only the package for the files that differed
for existing files. There is an additional class (Job) that had to be patched
that the version Android has and 1.6 does not have. The class is probably not
used on Android.

The okhttp CTS tests pass, modulo some tests known to be flaky.

Bug: 16628050
Bug: https://code.google.com/p/android/issues/detail?id=74026

(cherry picked from commit f6af62d5c9bb5e15649a80ebae973463e8e2dc46)

Change-Id: I3172789a17384666eba732a7782573e08f06a48c
ecordedResponse.java
nternal/RecordingOkAuthenticator.java
nternal/http/URLConnectionTest.java
f6af62d5c9bb5e15649a80ebae973463e8e2dc46 30-Jul-2014 Neil Fuller <nfuller@google.com> Fix transparent gzip for basic auth.

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

Thanks to mattpan91 for the report.

The issue was fixed in OkHttp 2.0. It has now been back-ported to 1.6.

This is a cherry pick from the okhttp_16 branch:
https://github.com/square/okhttp/commit/e8fee51087a062384f52e11400ff4a104a00a2b2

The merge was not entirely straightforward: Android is currently not quite
on 1.6; it is close and it was only the package for the files that differed
for existing files. There is an additional class (Job) that had to be patched
that the version Android has and 1.6 does not have. The class is probably not
used on Android.

The okhttp CTS tests pass, modulo some tests known to be flaky.

Bug: 16628050
Bug: https://code.google.com/p/android/issues/detail?id=74026
Change-Id: Ic179947f9f3664a4f2a7fcde435ec9fb7f1ae340
ecordedResponse.java
nternal/RecordingOkAuthenticator.java
nternal/http/URLConnectionTest.java
7c7f22d80748dc444d5da3c5be11d7d81ef14a2b 17-Jul-2014 Lorenzo Colitti <lorenzo@google.com> Allow callers to pass in a custom host resolver implementation.

An HTTP client interacts with the network in two main ways: DNS
lookups and connections to HTTP servers. OkHttp already abstracts
the latter by allowing callers to pass in custom SocketFactory
objects, but does not yet abstract the former.

This change takes the existing internal Dns interface, which is
currently used for testing, and turns it into a publicly
accessible HostResolver interface. This allows callers to
completely abstract all network interaction points.

Examples of what this can be used for:

1. Use alternative DNS implementations with different
performance / caching / ordering / parallelization / ...
characteristics than standard InetAddress.getAllByName.
2. Resolve hosts using different DNS servers than the system
resolvers, or even non-DNS protocols (e.g., MDNS or even
NetBIOS/WINS) that are not supported by the system resolver.
3. Do DNS lookups on specific networks, similarly to what
android_getaddrinfofornet does.

Backport of upstream change:
https://github.com/square/okhttp/commit/b19860c9297197a5055ac2ffd6edaedf693c1a85

Change-Id: I6e488acd938067e4c078c6ffe4d5eddb5f3951de
nternal/http/RouteSelectorTest.java
2695578b41932bb10d4aa5b9ec717c7c9b4b5d1a 17-Jul-2014 Lorenzo Colitti <lorenzo@google.com> Allow callers to pass in a custom host resolver implementation.

An HTTP client interacts with the network in two main ways: DNS
lookups and connections to HTTP servers. OkHttp already abstracts
the latter by allowing callers to pass in custom SocketFactory
objects, but does not yet abstract the former.

This change takes the existing internal Dns interface, which is
currently used for testing, and turns it into a publicly
accessible HostResolver interface. This allows callers to
completely abstract all network interaction points.

Examples of what this can be used for:

1. Use alternative DNS implementations with different
performance / caching / ordering / parallelization / ...
characteristics than standard InetAddress.getAllByName.
2. Resolve hosts using different DNS servers than the system
resolvers, or even non-DNS protocols (e.g., MDNS or even
NetBIOS/WINS) that are not supported by the system resolver.
3. Do DNS lookups on specific networks, similarly to what
android_getaddrinfofornet does.

Backport of upstream change:
https://github.com/square/okhttp/commit/b19860c9297197a5055ac2ffd6edaedf693c1a85

Change-Id: I6e488acd938067e4c078c6ffe4d5eddb5f3951de
nternal/http/RouteSelectorTest.java
1410c75d4b2334521208259b69c23aeefec072d7 17-Jul-2014 Lorenzo Colitti <lorenzo@google.com> Use the socket factory for direct connections as well.

Currently, the passed-in socket factory is only used for
connections to HTTP proxies. I think this was not the intent of
the original socket factory change, because the commit message
said that the "socket factory will be used for all non-proxy
connections and HTTP proxy connections". So use it for DIRECT
connections as well.

Also add a test to check that a socket factory is used if
specified.

Cherry-pick of https://github.com/square/okhttp/commit/7f763c1a18e342dc4e2840c68ca99c175c37eb93

(cherry picked from commit a83ddf194ffbae04ce536967efff0ec72df70e10)

Change-Id: Ie3d239d8683a51a2b6ab1dc9d443886d0746e68a
nternal/http/URLConnectionTest.java
a83ddf194ffbae04ce536967efff0ec72df70e10 17-Jul-2014 Lorenzo Colitti <lorenzo@google.com> Use the socket factory for direct connections as well.

Currently, the passed-in socket factory is only used for
connections to HTTP proxies. I think this was not the intent of
the original socket factory change, because the commit message
said that the "socket factory will be used for all non-proxy
connections and HTTP proxy connections". So use it for DIRECT
connections as well.

Also add a test to check that a socket factory is used if
specified.

Cherry-pick of https://github.com/square/okhttp/commit/7f763c1a18e342dc4e2840c68ca99c175c37eb93

Change-Id: I811b08442d1c80be1a0a268eb51c9aa365febf00
nternal/http/URLConnectionTest.java
3f968acf193178145e9d227f2f08b95e2d6a6c26 15-Apr-2014 Jake Wharton <jw@squareup.com> Allow specifying a socket factory for connections.

This socket factory will be used for all non-proxy connections and HTTP proxy connections.

This is a clean cherry-pick of:
https://github.com/square/okhttp/commit/ff5390d6dcaf79ef09a3ef94dbb7e8ac39572a7f

That was committed about two weeks after we pulled our current
snapshot, so we would have picked this change up on the next
sync with upstream.

Bug: 11826069

(cherry picked from commit e5baca5e4c9de92820a38e60e289d07f1acaa2ef)

Change-Id: Ica683022e6963a0a4f0c3fd1a33c1b843e307c1a
onnectionPoolTest.java
nternal/http/RouteSelectorTest.java
e5baca5e4c9de92820a38e60e289d07f1acaa2ef 15-Apr-2014 Jake Wharton <jw@squareup.com> Allow specifying a socket factory for connections.

This socket factory will be used for all non-proxy connections and HTTP proxy connections.

This is a clean cherry-pick of:
https://github.com/square/okhttp/commit/ff5390d6dcaf79ef09a3ef94dbb7e8ac39572a7f

That was committed about two weeks after we pulled our current
snapshot, so we would have picked this change up on the next
sync with upstream.

Bug: 11826069
Change-Id: I233c29b79770950b16bc82b36fb47f22369d9bd3
onnectionPoolTest.java
nternal/http/RouteSelectorTest.java
78092f38ebd93018ead53a87b53118dc829cbb8a 01-Apr-2014 Neil Fuller <nfuller@google.com> Pull upstream fixes from OkHttp

This synced to commit b21b40e480cdcd09b618e399a349556de509d88d
/ master / 1st April 2014.

Notably this contains a fix for apps that bundle an older
copy of OkHttp or which call android.net.http.HttpResponseCache.get()
or android.net.http.HttpResponseCache.put().

See for details:
https://github.com/square/okhttp/pull/672

Change-Id: I90acd9f9946014e834ea203dbc62cdcf7bc80cc6
onnectionPoolTest.java
nternal/http/JavaApiConverterTest.java
nternal/http/ThreadInterruptTest.java
nternal/http/URLConnectionTest.java
4944713f5c5b141966ac82973d6a31a634e8e01e 21-Mar-2014 Neil Fuller <nfuller@google.com> Pull upstream fixes from OkHttp

This synced to commit bda555ad61ef55e9ad6e4a30d2e9cfde5fc216ca
/ master / 21st March 2014.

Notably this contains a fix for apps that bundle an older
copy of OkHttp or which call android.net.http.HttpResponseCache.get()
or android.net.http.HttpResponseCache.put().

See for details:
https://github.com/square/okhttp/commit/6cf56de5d0701ff26aa6043c552e17c4665c1287
https://github.com/square/okhttp/commit/e2599be9e073f1be8e929597c358e2664ab0c9a9

Change-Id: I324ac76d8ee6a615c39dc8e19dc90169528ae072
nternal/http/HttpResponseCacheTest.java
nternal/http/JavaApiConverterTest.java
nternal/http/ResponseCacheAdapterTest.java
nternal/spdy/HpackDraft05Test.java
c6bd683320121544811f481709b3fdbcbe9b3866 14-Mar-2014 Neil Fuller <nfuller@google.com> Upgrade OkHttp to newer code

This update includes changes up to
68affbd24d63620e1785ea847f1936760947b9ae / master /
14th March 2014.

Importantly, it contains a DiskLruCache fix which
broke several apps.
https://github.com/square/okhttp/issues/646

Change-Id: I8a489e6d0937a58fad10423154bad939ea4da868
syncApiTest.java
ecordingReceiver.java
yncApiTest.java
nternal/http/HttpResponseCacheTest.java
nternal/http/URLConnectionTest.java
nternal/spdy/MockSpdyPeer.java
nternal/spdy/SettingsTest.java
nternal/spdy/SpdyConnectionTest.java
3c938a3f6b61ce5e2dba0d039b03fe73b89fd26c 19-Feb-2014 Neil Fuller <nfuller@google.com> Update okhttp to a more recent commit.

Updating to upstream commit : 7b106923e078ac2435e8c8ce9d615f9903106ed8
/ 7th Mar 2014 / main branch.

The following changes were made to Android-only code:
1) HttpsHandler has been changed to deal with the fix for:
https://github.com/square/okhttp/issues/184 (commit 5d7fdba).
2) Platform.java changed to accomodate changes in okhttp Platform
method signatures.
3) .mk file updates to reflect src directory changes.

The following changes were made to OkHttp code:
1) Removal of org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
annotation from okio/src/main/java/okio/DeflaterSink.java

Change-Id: I644a883482ac7ee7d029785f110a2ca00762419b
syncApiTest.java
onnectionPoolTest.java
ispatcherTest.java
ediaTypeTest.java
ecordedResponse.java
ecordingReceiver.java
equestTest.java
yncApiTest.java
nternal/BitArrayTest.java
nternal/RecordingAuthenticator.java
nternal/RecordingHostnameVerifier.java
nternal/RecordingOkAuthenticator.java
nternal/http/CookiesTest.java
nternal/http/ExternalHttp2Example.java
nternal/http/ExternalSpdyExample.java
nternal/http/HeadersTest.java
nternal/http/HttpOverHttp20Draft09Test.java
nternal/http/HttpOverSpdy3Test.java
nternal/http/HttpOverSpdyTest.java
nternal/http/HttpResponseCacheTest.java
nternal/http/ResponseCacheAdapterTest.java
nternal/http/ResponseCacheTest.java
nternal/http/RouteSelectorTest.java
nternal/http/StatusLineTest.java
nternal/http/URLConnectionTest.java
nternal/http/URLEncodingTest.java
nternal/spdy/BaseTestHandler.java
nternal/spdy/HpackDraft05Test.java
nternal/spdy/Http20Draft09Test.java
nternal/spdy/HuffmanTest.java
nternal/spdy/MockSpdyPeer.java
nternal/spdy/SettingsTest.java
nternal/spdy/Spdy3Test.java
nternal/spdy/SpdyConnectionTest.java
nternal/tls/FakeSSLSession.java
nternal/tls/HostnameVerifierTest.java