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

46 Commits

Author SHA1 Message Date
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
Jesse Wilson
cc92c4cecc [maven-release-plugin] prepare for next development iteration 2014-05-24 02:03:47 -04:00
Jesse Wilson
8dcc74d339 [maven-release-plugin] prepare release parent-2.0.0-RC1 2014-05-24 02:03:37 -04:00
Adrian Cole
5648a6868d In HttpURLConnection, pay attention when fixedContentLength is set to zero. 2014-05-22 08:48:40 -07:00
Jesse Wilson
ed70981925 Strip auth headers when redirected to another host.
These are potentially private and we don't want to leak them to another
host, regardless of whether they're created by the calling application or
by the Authenticator.
2014-05-19 23:18:07 -04:00
Jesse Wilson
22a03b59fa Drop ResponseSource. 2014-05-19 11:01:22 -04:00
Jesse Wilson
0676d8b173 Move code to the urlconnection module.
We don't need this code for the core OkHttp API.
2014-05-17 21:00:46 -04:00
Jesse Wilson
271cc7b632 First steps at making URLConnection a shim.
This extracts the URLConnection APIs to their own project. I still need to
go back and clean up some names in tests, add documentation, and move the
actual HttpURLConnection implementation details into this module.
2014-05-17 18:40:01 -04:00