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

1045 Commits

Author SHA1 Message Date
Jesse Wilson
4bea2830d9 Test that duplex works fine with interceptors 2019-02-26 21:48:28 -05:00
Jesse Wilson
e6cfc2a508 Apply whole-operation timeouts to setup of web sockets and duplex calls
https://github.com/square/okhttp/issues/4646

Still need to figure out SSE.
2019-02-26 09:38:31 -05:00
Jesse Wilson
7f74fcc9bd Include 'timeout' in exceptions when that's the root cause
I'm not particularly happy with the way this code looks, but I like
the result. Otherwise exceptions are like these:

  * stream was reset: CANCEL
  * Socket closed
  * Canceled
2019-02-25 10:33:18 -05:00
Jesse Wilson
8b98cce941 Fix the name of a TLSv1.3 cipher suite, TLS_AES_128_CCM_8_SHA256
I think we made either a transcription error or grabbed a suite
from an earlier version of the spec.
2019-02-24 10:31:20 -05:00
Jesse Wilson
1a1a6827ce Merge pull request #4650 from square/jwilson.0223.late_call_calls_cancel
Fix a bug where responses weren't closed on a late cancel
2019-02-24 06:34:29 -05:00
Jesse Wilson
da20361db5 Fix a bug where responses weren't closed on a late cancel
Closes: https://github.com/square/okhttp/issues/4583
2019-02-23 20:26:19 -05:00
Jesse Wilson
aac6c8da07 Introduce EventListener.requestFailed, responseFailed events
These replace requestBodyEnd() / responseBodyEnd() in some failure scenarios.
They may also be issued in cases where no event was published previously.
2019-02-23 18:39:11 -05:00
Jesse Wilson
c8b1ee602b Support follow-ups for duplex requests.
https://github.com/square/okhttp/issues/4267
2019-02-23 11:05:58 -05:00
Jesse Wilson
cccf6e4118 Merge pull request #4644 from square/jwilson.0223.duplex_continue
Test duplex with Expect/Continue
2019-02-23 11:01:45 -05:00
Jesse Wilson
e890ba6142 Test duplex with Expect/Continue 2019-02-23 09:31:18 -05:00
Benoit Quenaudon
4c03ed2075 Crashes when duplex meets http1 2019-02-22 18:42:42 -05:00
Benoit Quenaudon
0914607dd7 EventListener supports response overlasting request 2019-02-22 16:40:55 -05:00
Jesse Wilson
38cba03ec2 Merge pull request #4635 from square/jwilson.0217.request_failure
Test to confirm OkHttp doesn't loop when a request body throws.
2019-02-18 18:51:45 -05:00
Jesse Wilson
cdacead7fa Merge pull request #4634 from square/jwilson.0217.rename_http_codec
Rename HttpCodec to ExchangeCodec
2019-02-17 22:37:51 -05:00
Jesse Wilson
8ca07d21f6 Test to confirm OkHttp doesn't loop when a request body throws.
Test to reproduce the issue discussed here:
https://github.com/square/okhttp/pull/4523
2019-02-17 22:37:23 -05:00
congwu.wang
77f3cec493 fix: StreamAllocation should keep route from reused connection 2019-02-17 22:18:07 -05:00
Jesse Wilson
88a958cc71 Rename HttpCodec to ExchangeCodec
Also address feedback from other exchange PRs.
2019-02-17 22:08:51 -05:00
Jesse Wilson
f9587aad2c Fix EventListener events for expect-continue.
We were calling responseHeadersStart() multiple times.
2019-02-17 20:43:27 -05:00
Jesse Wilson
d882f202eb Restore tests that now report the correct events.
The change to introduce Transmitter and Exchange has caused us to report
the correct events. Yay!
2019-02-17 17:28:12 -05:00
Jesse Wilson
59e68cd2bc Introduce Exchange.
This is the payoff that preceding changes have been working towards.
This splits StreamAllocation into three parts:

 - ExchangeFinder: strategy to allocate connections for exchanges
 - Exchange: a single request/response pair
 - Transmitter: a sequence of exchanges for a Call

The refactoring isn't totally complete, but this should be the last
big one.

https://github.com/square/okhttp/issues/4603
2019-02-17 13:14:35 -05:00
Jesse Wilson
7b4b7fecb2 Make connection coalescing less special.
Today we have to suppress 'connectionAcquired' events because we attach the
constructed connection and then replace it with the pooled one. This changes
the logic to use separate fields for the connecting connection vs. the
pooled one.
2019-02-17 07:36:03 -05:00
Jesse Wilson
ca37ac991a Handle stream exceptions in Transmitter
This changes failure recovery to only attempt when the failure
occurs when OkHttp is doing I/O. If a failure is triggered by
something else (such as a bad RequestBody or Interceptor) then
that failure will not be retried.

https://github.com/square/okhttp/issues/4603
2019-02-17 07:23:15 -05:00
Jesse Wilson
20c46127a6 Manage releasing connection separately from HTTP framing
This creates a new class ResponseBodySource that manages events and
connections. It's symmetric with our existing RequestBodySink class.

Continuing to work towards these things having their own lifecycles
that are separate from HTTP framing mechanics.

https://github.com/square/okhttp/issues/4603
2019-02-16 10:04:54 -05:00
Jesse Wilson
7f4b8b657b Prepare to push more StreamAllocation state into Connection and HttpCodec 2019-02-16 00:07:17 -05:00
Jesse Wilson
fe9f151d74 Split ConnectionPool API from implementation
Our 'Internal' trampoline really gets in the way with this one. Just
move the actual implementation code into its own type so there isn't
as much indirection.

Unfortunately we can't easily make RealConnectionPool extend from
ConnectionPool because otherwise we'd be open to any user-provided
connection pools and our API isn't that complete yet.
2019-02-15 15:01:02 -05:00
Jesse Wilson
2594c6c695 Don't call callEnd() twice when application interceptors proceed twice.
I'm working towards reducing the role StreamAllocation plays.

https://github.com/square/okhttp/issues/4603
2019-02-15 13:29:13 -05:00
Jesse Wilson
46ec605734 Prepare to fold StreamAllocation and Transmitter
This is a mechanical refactoring that changes all code that directly
accesses a StreamAllocation to instead access a Transmitter. The
next step is to combine StreamAllocation and Transmitter into
a single class.
2019-02-14 14:34:32 -05:00
Yuri Schimke
b21762f91c Fix master build for JDK 11 2019-02-09 13:28:59 +00:00
Yuri Schimke
50df11c471 Build with 3 JDK targets (#4568)
* Build with 3 targets

* Update maven

* remove jdk 12 ea

* Try without errorprone temporarily

* Still set 1.8

* javadoc tolerance

* Profiles for 10 + 11

* More tolerant

* JDK 11 test skipping

* Cleanup imports

* Link to github issues

* Support JDK 12 building
2019-02-09 07:32:49 -05:00
Jesse Wilson
0a59e68b16 [maven-release-plugin] prepare for next development iteration 2019-02-05 12:15:46 -05:00
Jesse Wilson
d28d2cec21 [maven-release-plugin] prepare release parent-3.13.1 2019-02-05 12:15:39 -05:00
Jesse Wilson
5ecd590c8c [maven-release-plugin] prepare for next development iteration 2019-02-04 23:32:52 -05:00
Jesse Wilson
d55661544b [maven-release-plugin] prepare release parent-3.13.0 2019-02-04 23:32:45 -05:00
Jesse Wilson
392165d238 Improve testing in MockDuplexResponseBody 2019-02-03 21:56:39 -05:00
Jesse Wilson
94c38da706 Permit multipart filenames to contain non-ascii characters
Closes: https://github.com/square/okhttp/issues/4564
2019-02-02 12:55:32 -05:00
iamdanfox
56f55d9914 Dispatcher no longer has quadratic behaviour (#4581)
* Dispatcher#promoteAndExecute is no longer quadratic

* Maintain map internally

* Factor out two deques to RunningCall class

* Checkstyle

* Revert map-based implementation

* RealCall tracks calls per host using an AtomicInteger

* Loop through both ready and queued

* Empty commit for CI
2019-02-01 07:00:50 -05:00
Jesse Wilson
8dcfaf02b5 Turn DuplexRequestBody into a marker interface.
And later maybe a simple public method.
2019-01-31 19:42:06 -05:00
Benoit Quenaudon
d50ea813cc Decouples DuplexRequestBody from Callback and let the caller deal with that 2019-01-28 14:45:03 -05:00
Jesse Wilson
2f4b90050e Merge pull request #4550 from square/jwilson.0111.nonoptional
Core TLS features are now non-optional on Android
2019-01-19 17:11:12 -05:00
Jesse Wilson
3512ec5c9b Add tests that exercise real duplex communication
We're currently broken because the Pipe doesn't flush. Will fix in Okio.
2019-01-17 22:44:56 -05:00
Jesse Wilson
9d28d9c9e2 Get trailers working for HTTP/1
The most awkward part of this is the changes to the way MockResponse
handled chunked encoding. It used to consider trailers a part of its
chunked response; now it does not.
2019-01-14 22:33:54 -05:00
Jesse Wilson
e1e5ba8366 Merge pull request #4547 from square/bquenaudon/2019-01-05/newduplexapi
Finalizes Duplex APIs for gRPC
2019-01-13 21:53:15 -05:00
Benoit Quenaudon
7bdb700a3e Finalizes Duplex APIs for gRPC 2019-01-12 20:40:32 -05:00
Jesse Wilson
4fb5e71fe7 Core TLS features are now non-optional on Android
With a baseline of 5.0+ we will have session tickets, SNI, and ALPN.
2019-01-11 23:58:11 -05:00
Jesse Wilson
778e0334a4 Use lambdas where appropriate 2019-01-11 22:31:36 -05:00
Amir Livneh
2595a48119 Test for and fix connection leaks in CallTest
The connection leak in ConnectionReuseTest.connectionsAreNotReusedIfNetworkInterceptorInterferes() contaminated the shared connection pool and failed tests in CallTest.

Also removed calls to ConnectionPool.evictAll() that became redundant.
2019-01-07 09:58:06 -05:00
Amir Livneh
48e108000b Fix flaky WebSocketHttpTest.webSocketAndNetworkInterceptors
close() is already called on the client WebSocket in closeWebSockets().
2019-01-07 07:12:47 -05:00
Amir Livneh
aeda2cb347 Respond to server-initiated closure with client-initiated closure
This fixes a connection leak in WebSocketHttpTest.unplannedCloseHandledWithoutFailure().

Fixes part of https://github.com/square/okhttp/issues/4515.
2019-01-05 13:23:41 -05:00
Jesse Wilson
318aa514b9 Merge pull request #4531 from amirlivneh/websocket-response-check-leak
Fix connection leak on failed WebSocket handshake
2019-01-05 12:45:25 -05:00
Jesse Wilson
7ddd4ac279 Merge pull request #4525 from amirlivneh/onopen-leak
Fix connection leak if WebSocketListener.onOpen() throws
2019-01-05 12:44:33 -05:00