1
0
mirror of https://github.com/square/okhttp.git synced 2025-11-26 06:43:09 +03:00
Commit Graph

57 Commits

Author SHA1 Message Date
Jesse Wilson
c8bd6f834d Merge pull request #1555 from nfuller/AggressiveUncaughtExceptionHandler
Install an UncaughtExceptionHandler during tests
2015-05-01 10:54:41 -04:00
Jesse Wilson
80901a680a Merge pull request #1559 from square/jwilson_0414_never_default_body
Never convert null into an empty request body.
2015-04-16 20:20:51 -04:00
jwilson
1abba290f5 Never convert null into an empty request body.
This is a behavior change.
2015-04-16 19:53:13 -04:00
Neil Fuller
4e08085cc8 Install an UncaughtExceptionHandler during tests
This is to make the tests more brittle around uncaught exceptions
as they are on Android. No uncaught exceptions should escape.
2015-04-14 16:55:26 +01:00
Neil Fuller
60f5406dcc Move TLS retries / fallback into Connection.
API changes:
1) Added: Address.getCertificatePinner()
2) Incompatible API change: Address constructor no longer
includes ConnectionSpecs. Removed getConnectionSpecs().
3) Added: ConnectionSpec.isCompatible(SSLSocket)
4) Added: TlsVersion.javaName()

Implicit / semantic / internal changes:

1) Connection now handles all attempts to connect via a route
(effectively a {proxy, socket address} pair), rather than just
one attempt. i.e. Connection now handles all the TLS negotiation
fallbacks internally.

2) Route no longer deals with TLS versions. Individual TLS
failures are not counted against a Route. If no connection
attempts to a route were successful the failure is counted
against the route.

3) The code makes a distinction between when various
IOExceptions occur, with the intention making retries a bit
smarter. It is now more obvious which exceptions happen during
setup (RequestException), connection (RouteException),
HTTP communication and thus which can be retried and whether
the request might have been sent.
2015-03-18 15:59:37 +00:00
jwilson
0237d3c3f2 [maven-release-plugin] prepare for next development iteration 2015-03-16 22:28:12 -04:00
jwilson
c49eedeba3 [maven-release-plugin] prepare release parent-2.3.0 2015-03-16 22:28:09 -04:00
jwilson
4db679b39e Send at most one condition.
Related to https://github.com/square/okhttp/issues/831
Closes: https://github.com/square/okhttp/issues/1354
2015-01-30 17:29:57 -05:00
Jesse Wilson
74001bbdb6 Merge pull request #1332 from jbornemann/update_http_default_cache_codes
Update http default cache codes
2015-01-16 22:52:54 -05:00
Jeff Bornemann
515ae8fef6 cache-by-default status codes now up to date 2015-01-16 17:07:47 -05:00
Neil Fuller
c9b0262c40 Create a new maven artifact to hold things needed for Android embedding
okhttp-android-support contains classes needed for Android embedding and
not for normal OkHttp development. The classes here can be excluded from
okhttp-urlconnection, shrinking that artifact. More classes will be
added to this component to make Android maintenance easier.
2015-01-12 10:55:17 +00:00
Jake Wharton
c46b61d565 Use 'Headers' in recorded response. 2015-01-05 22:38:23 -08:00
Jesse Wilson
f84c2c022a Merge pull request #1290 from square/jw/start
Rename play to start.
2015-01-05 10:32:51 -05:00
Jake Wharton
c5c4e7857c Expose Headers directly on MockResponse. 2015-01-05 00:42:01 -08:00
Jake Wharton
8e201297fe Update MockWebServer to use Headers. 2015-01-05 00:18:56 -08:00
Jake Wharton
5355762a6f Rename play to start. 2015-01-04 23:17:42 -08:00
Jesse Wilson
1d86439e90 [maven-release-plugin] prepare for next development iteration 2014-12-30 21:52:35 -05:00
Jesse Wilson
6aef5ab3c5 [maven-release-plugin] prepare release parent-2.2.0 2014-12-30 21:52:33 -05:00
Jesse Wilson
e49dd7a2f0 Limit 20 authorization attempts.
We use one count for both redirects and authorization attempts. This
seems like good enough policy.

Closes https://github.com/square/okhttp/issues/960
2014-12-30 12:14:49 -05:00
Jesse Wilson
1d6f0e75d5 Cache 302s and 308s with the right response headers.
Closes https://github.com/square/okhttp/issues/1158
2014-12-29 18:47:36 -05:00
Jesse Wilson
785d9e9438 Use MockWebServerRule in more tests.
Also fix a bug in MockWebServer where calls to shutdown()
raced with calls to play() would throw a NullPointerException.

Also improve logging in MockWebServer.
2014-12-27 13:05:36 -05:00
Jake Wharton
15c81fdfc2 Normalize caching size in loop-local variable.
This was present in a bunch of loops, but not all and not consistently. After fixing two, I figured that I would normalize them all under the umbrella of uniformity and being lazy (only lookup up the value once if it never changes).
2014-12-24 11:33:14 -08:00
Jake Wharton
5e62ed01a7 Move a constant to the file of its only use. 2014-12-22 16:15:12 -08:00
Jesse Wilson
27c6e69c82 Network interceptors.
These exist between the OkHttp features (gzip, response cache, retry, route
planning, etc.) and the network server. They can be used to rewrite the response
headers and body from what the server actually returned to what the client wants.

For example, the interceptor could inject a missing 'Cache-Control' header to make
caching work better.
2014-12-22 13:45:25 -05:00
Jesse Wilson
32b7675b72 Use ResponseBody to model the response body everywhere.
This makes cache writing and gzip layering work a bit nicer
because there are fewer fields in HttpEngine to track the
various competing streams.
2014-12-21 23:41:57 -05:00
Jesse Wilson
e74e3f3bf7 Move cache writing out of the transport.
This is necessary to unblock network interceptors, where the interceptor
may elect to rewrite the response body. If we've already cached the
original response body, we're too late.
2014-12-21 21:21:55 -05:00
Jake Wharton
789b536cb3 Working towards 2.2.0. 2014-11-29 18:15:31 -08:00
Jake Wharton
ff622aff0f Merge pull request #1129 from square/websockets
Websockets!
2014-11-29 16:54:51 -08:00
Neil Fuller
d003dec9ac Avoid hardcoding the custom header prefix so the test uses the Platform value
The test is failing under Android CTS tests. Android uses an "X-Android"
prefix.

This fix is benign and ensures the test passes in all cases.
2014-11-26 14:17:48 +00:00
Jesse Wilson
64b607fc11 Request body buffering is not transport-specific.
Previously we were only buffering the request body when the transport
was HTTP. But we should buffer it for both SPDY and HTTP transports.

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

Also recover gracefully when retrying an empty POST body. This
is a related bug.

Closes https://github.com/square/okhttp/issues/1131
2014-11-10 21:20:51 -05:00
Jake Wharton
b72c9567df Hook up the web socket reader and writer together.
Add a simple real-world recipe which talks to an echo server.
2014-11-04 23:29:57 -08:00
Jesse Wilson
ec1b266f1d [maven-release-plugin] prepare for next development iteration 2014-11-05 02:12:03 -05:00
Jesse Wilson
7b6771bb29 [maven-release-plugin] prepare release parent-2.1.0-RC1 2014-11-05 02:12:01 -05:00
Jesse Wilson
0316426ecf Bump pom versions to 2.1.0-SNAPSHOT. 2014-11-05 00:21:52 -05:00
Jesse Wilson
112f020c41 Change the cache to have non-shared semantics.
This means we'll cache responses that use an 'Authorization' header. This
means OkHttp's cache shouldn't be used on middleboxes that sit between
user agents and the origin server; in practice this is never a use case
for OkHttp.

Fixes https://github.com/square/okhttp/issues/1035
2014-11-01 11:53:13 -04:00
Jesse Wilson
f80b1f3a4a Fix a bug where the response cache could be corrupted.
When streaming a response, we copy data from our buffer to the cached file
on disk. Unfortunately we were copying N bytes from the front of the buffer
when we wanted N bytes from the back of the buffer.

Typically these are the same, but certain access patterns can cause them
to be different, corrpting the cached file on disk.

This was uncovered by migrating the cache tests from operating on
HttpURLConnection's API to our new API.
2014-10-27 11:00:01 -04:00
Jake Wharton
3a4c135529 Convert disk cache to use Okio. 2014-08-17 23:46:27 -07:00
Jesse Wilson
2cf38851d2 Merge pull request #944 from MiguelLavigne/feature/mlavigne/fix_do_not_follow_redirects
Fixes the do not follow redirects bug
2014-06-28 08:44:43 -06:00
Miguel Lavigne
7d5c42a1b2 Fixes the do not follow redirects bug
The HttpEngine would not obey the set state because there was no
correlation between the HttpURLConnection.setInstanceFollowRedirects
method and the OkHttpClient.

Fixed the missing link by adding a new setFollowRedirects method to the
OkHttpClient class.  Bridged the gap for the HttpURLConnection.setInstanceFollowRedirects
by forwarding that state into the OkHttpClient.

Now the HttpEngine will always obey the OkHttpClient redirect state when
attempting the followUp phase.

Added necessary test to both OkUrlFactoryTest and CallTest.

https://github.com/square/okhttp/issues/943
2014-06-24 07:45:09 -04:00
Jesse Wilson
f2d5fcbd40 [maven-release-plugin] prepare for next development iteration 2014-06-21 00:02:22 -04:00
Jesse Wilson
a3c18f69c9 [maven-release-plugin] prepare release parent-2.0.0 2014-06-21 00:02:19 -04:00
Jake Wharton
cdd71f1bbd Update the language level to Java 7. 2014-06-17 13:36:42 -07:00
Jesse Wilson
2cea341be1 [maven-release-plugin] prepare for next development iteration 2014-06-11 01:36:58 -04:00
Jesse Wilson
f171096b11 [maven-release-plugin] prepare release parent-2.0.0-RC2 2014-06-11 01:34:55 -04:00
Jesse Wilson
bdb5c2f4e9 Don't include a weird user-agent in the new API. 2014-06-10 22:26:07 -04:00
Jesse Wilson
baba1c090d Make the content type optional.
https://github.com/square/okhttp/issues/899
2014-06-08 11:29:41 -04:00
Jake Wharton
32c75ea09f Merge pull request #874 from square/jw/response-source-header
Expose backwards-compatible response source header.
2014-05-29 22:01:21 -07:00
Jake Wharton
e31b737763 Expose backwards-compatible response source header. 2014-05-29 21:58:21 -07:00
Jake Wharton
8f6a21e864 Restore Java 7-specific override annotation.
We require Java 7 to build now and this doesn't affect Java 6 at runtime.
2014-05-29 13:52:36 -07:00
Jesse Wilson
e870d2645a Build Javadoc for OkUrlFactory and OkApacheClient.
Also create a permanent URL for 1.x Javadoc.
2014-05-24 17:35:20 -04:00