1
0
mirror of https://github.com/square/okhttp.git synced 2026-01-17 08:42:25 +03:00
Commit Graph

2522 Commits

Author SHA1 Message Date
jwilson
358d96c5fb [maven-release-plugin] prepare release parent-3.3.1 parent-3.3.1 2016-05-28 14:11:52 -04:00
jwilson
455b8df2e9 Update changelog for OkHttp 3.3.1. 2016-05-28 14:07:21 -04:00
Jake Wharton
80a799c0c0 Merge pull request #2587 from square/jwilson.0528.nonascii
Don't crash reading non-ASCII characters from the server or the cache.
2016-05-28 13:34:25 -04:00
Jake Wharton
8ddc587523 Merge pull request #2586 from square/jwilson.0528.newlines
Fix HttpLoggingInterceptor to be cool with newlines.
2016-05-28 13:31:58 -04:00
jwilson
dd4dd05d25 Merge branch 'yschimke-java9_tests'
* yschimke-java9_tests:
  tests running in JDK 9
2016-05-28 13:09:30 -04:00
Yuri Schimke
8ceb7480f3 tests running in JDK 9 2016-05-28 13:09:24 -04:00
jwilson
3ec5227d26 Don't crash reading non-ASCII characters from the server or the cache.
This doesn't completely support ISO-8859-1 headers; instead they will most likely
be mangled when they are decoded as UTF-8. If we decide we absolutely must support
ISO-8859-1 here we can do that in another change. (I'm not currently enthusiastic
about this idea.)

But this does prevent OkHttp from crashing when it encounters non-ASCII characters
in headers for HTTP/2, SPDY, and cached responses.

Closes: https://github.com/square/okhttp/issues/1998
2016-05-28 12:08:42 -04:00
Jesse Wilson
639b279159 Merge pull request #2583 from square/dr.may27.ws-retain-body
Retain response body when web socket returns non-101 response code.
2016-05-28 10:52:38 -04:00
jwilson
8271dc0fb1 Fix HttpLoggingInterceptor to be cool with newlines.
Unfortunately our plaintext detector treats \r and \n as non-plaintext
characters, and they're completely fine.

Closes: https://github.com/square/okhttp/issues/2579
2016-05-28 10:49:31 -04:00
Dave Roberge
8adf3d4a95 Retain response body when web socket returns non-101 response code.
This change also fixes an edge case where a server returns a response
that allows a follow up request. Previously, this would cause an
exception because the body was being ignored.
2016-05-27 08:35:36 -04:00
jwilson
16aed96a35 [maven-release-plugin] prepare for next development iteration 2016-05-24 22:12:31 -04:00
jwilson
b031042e67 [maven-release-plugin] prepare release parent-3.3.0 parent-3.3.0 2016-05-24 22:12:28 -04:00
jwilson
6b9eeb18d4 Update changelog for OkHttp 3.3.0. 2016-05-24 22:08:43 -04:00
Jesse Wilson
acbd4e4d13 Merge pull request #2571 from square/jwilson.0521.recover_from_refused_stream
Recover from REFUSED_STREAM errors in HTTP/2.
2016-05-24 21:40:23 -04:00
jwilson
c9290b7696 Recover from REFUSED_STREAM errors in HTTP/2.
This implements the following policy:

 - If a REFUSED_STREAM error is received, OkHttp will retry the same stream
   on the same socket 1x.
 - If any other error is received, or an additional REFUSED_STREAM error is
   received, OkHttp will retry on a different route if one exists.

We may want to follow up by going through HTTP/2 error codes and deciding
a per-code retry policy, but this should be good enough for now.

Closes: https://github.com/square/okhttp/issues/2543
2016-05-24 21:40:09 -04:00
Jesse Wilson
ed943ce136 Merge pull request #2574 from square/jwilson.0522.flush_on_window_updates
Flush streams if the window size is zero.
2016-05-22 23:15:10 -04:00
jwilson
1503e362f6 Flush streams if the window size is zero.
Otherwise we can deadlock, with OkHttp waiting for the server to send a larger
window and the server not knowing that there's a stream that even wants it.
2016-05-22 10:18:10 -04:00
Jesse Wilson
3f7a3344a4 Merge pull request #2572 from square/jwilson.0521.close_examples
Better documentation and examples on closing response bodies.
2016-05-21 22:23:48 -04:00
jwilson
3699d5c9fd Better documentation and examples on closing response bodies.
Also implement Closeable on Response to make it easier to do the right thing.
2016-05-21 21:29:42 -04:00
Jesse Wilson
0693302fca Merge pull request #2559 from square/jwilson_0514_bad_interceptor_check
Another approach to handling strange interceptor bodies.
2016-05-14 16:52:01 -04:00
jwilson
ec0301acb4 Another approach to handling strange interceptor bodies.
The previous approach Just Works if users have fancy or interesting interceptors
that genuinely need to swap the response body in an interceptor and keep the
original body.

One problem with that solution is that although it gives expert users a powerful
way to separate response bodies, it also allows normal users to accidentally leak
response bodies in their interceptors.

This is an alternate solution that forbids the expert use case and requires that
closing the response body stream also closes the underlying socket stream. It
throws an exception if that implicit contract is not honored.

I'm fine with either solution but think we should consider both.
2016-05-14 14:05:56 -04:00
jwilson
61c1dad837 Merge branch 'adennie-log-connect-failure'
* adennie-log-connect-failure:
  update Logging Interceptor to log connection failures
2016-05-14 13:21:36 -04:00
Andy Dennie
f1dea26fd6 update Logging Interceptor to log connection failures 2016-05-14 13:21:09 -04:00
Jake Wharton
03d4edcc2e Merge pull request #2555 from square/jwilson.0512.close_response_body
Don't crash when a stream hasn't been closed.
2016-05-13 15:14:36 -07:00
jwilson
a54adcef12 Don't crash when a stream hasn't been closed.
Closes: https://github.com/square/okhttp/issues/2409
2016-05-12 21:04:10 -04:00
Jake Wharton
276ef646cd Merge pull request #2544 from square/jwilson.0508.no_synthetic_headers
Promote sent and received timestamps to fields on Response.
2016-05-09 00:03:38 -04:00
jwilson
bab8943f2b Promote sent and received timestamps to fields on Response.
I'm currently keeping these as longs. That's easy an unambiguous, but it also
feels rather primitive.

This was more work than I expected, but it doesn't seem particularly risky.
It's also potentially more efficient, since there's fewer places where we're
converting from string to long and vice versa.

Closes: https://github.com/square/okhttp/issues/2035
2016-05-08 15:25:56 -04:00
Jesse Wilson
7067047312 Merge pull request #2539 from square/jwilson.0507.dispatcher_shutdown
Unblock waiting dispatchers on MockWebServer shutdown.
2016-05-08 09:59:53 -04:00
Jesse Wilson
3dc5ab2353 Merge pull request #2540 from square/jwilson.0507.logging
Make logging more consistent throughout OkHttp.
2016-05-08 09:59:24 -04:00
jwilson
4f24a30c12 Make logging more consistent throughout OkHttp.
Avoid using System.out.

Use the best logging implementation on the host platform. On Java this is
java.util.logging. On Android it's Android.util.Log.

Closes https://github.com/square/okhttp/issues/2505
2016-05-07 21:08:37 -04:00
jwilson
ae5c364051 Unblock waiting dispatchers on MockWebServer shutdown.
Closes https://github.com/square/okhttp/issues/2521
2016-05-07 18:56:30 -04:00
Jake Wharton
80ab4a3761 Merge pull request #2538 from square/jwilson.0507.fewer_pins
Pin fewer certificates in our sample.
2016-05-07 18:45:51 -04:00
jwilson
94bda42362 Pin fewer certificates in our sample.
Closes: https://github.com/square/okhttp/issues/2535
2016-05-07 18:21:50 -04:00
Jesse Wilson
4505c1b856 Merge pull request #2520 from yschimke/platform_cleanup
split out platform and test them based on active profile
2016-05-07 18:13:45 -04:00
Yuri Schimke
3c51907351 split out platform building now that there are 4 2016-05-05 14:34:06 +10:00
Jake Wharton
be605dd647 Merge pull request #2529 from square/jwilson_0502_okio
Upgrade to Okio 1.8.0.
2016-05-02 01:33:21 -04:00
jwilson
ba51f5bff8 Upgrade to Okio 1.8.0. 2016-05-02 00:48:15 -04:00
Jesse Wilson
312ebb36c6 Merge pull request #2528 from Mauin/update_junit
updates junit version to v4.12
2016-05-01 12:09:28 -04:00
Marvin Ramin
8f8018ce5d updates junit version to v4.12 2016-05-01 10:48:15 +02:00
Jesse Wilson
adc97d5537 Merge pull request #2523 from venilnoronha/issue-2522-fix
Setting default String locale to Locale.US
2016-04-28 22:41:10 -04:00
Venil Noronha
4b0c09eb6f Fixes #2522 - Format String using Locale.US. 2016-04-29 08:05:35 +05:30
jwilson
48ff30b428 Merge branch 'venilnoronha-issue-2513-fix'
* venilnoronha-issue-2513-fix:
  Fixes #2513 - NetworkSecurityPolicy based ConnectionSpec setup.
2016-04-26 23:42:09 -04:00
Venil Noronha
e3cd9b9f1c Fixes #2513 - NetworkSecurityPolicy based ConnectionSpec setup. 2016-04-26 23:41:58 -04:00
Jesse Wilson
209c6c5589 Merge pull request #2507 from yschimke/java8_new
build with new alpn-boot and jdk 8 in travis
2016-04-23 23:08:57 -04:00
Yuri Schimke
6f18cc346a build with new alpn-boot and jdk in travis 2016-04-23 08:43:56 -07:00
Jake Wharton
a44b5ecfff Merge pull request #2502 from square/jwilson_0421_moshi
Use Moshi in OkHttp.
2016-04-22 13:46:55 -04:00
jwilson
ad103f421e Use Moshi in OkHttp.
As discussed here: https://github.com/square/okhttp/pull/2492
2016-04-21 23:20:30 -10:00
Jesse Wilson
081c74433c Merge pull request #2494 from yschimke/alpn_java9_support
Java 9 support for ALPN without alpn-boot
2016-04-21 21:57:27 -10:00
Jesse Wilson
bd76ea26e4 Merge pull request #2495 from yschimke/sni_doc
document support for SNI in OpenJDK
2016-04-21 21:56:34 -10:00
Jesse Wilson
ba54110370 Merge pull request #2496 from yschimke/retain_frame_logger
retain logger instance to actually log things
2016-04-21 09:00:28 -10:00