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

1056 Commits

Author SHA1 Message Date
Jesse Wilson
1a68cf15af Provide better exceptions when the shared HTTP/2 stream fails
Previously we always provided a generic StreamResetException. Now we provide
the exception that triggered the stream to be closed, if any.
2019-03-12 09:21:02 -04:00
Yuri Schimke
af72a230f3 Test Timeout to flush out hangs 2019-03-08 22:02:41 +00:00
Amir Livneh
018510fa40 Rename OkHttpClientTestingRule to OkHttpClientTestRule 2019-03-07 07:24:05 -05:00
Jesse Wilson
9059c15c67 Merge pull request #4684 from square/jwilson.0305.dontleak
Don't leak a connection if a WebSocket handshake fails
2019-03-06 20:55:54 -05:00
Jesse Wilson
dff5a61fc6 Don't leak a connection if a WebSocket handshake fails
I'm not particularly happy with all of the moving parts here. I think
perhaps doing web sockets over duplex is a possible fix here.

Closes: https://github.com/square/okhttp/issues/4658
2019-03-06 20:40:33 -05:00
Amir Livneh
aca6785440 Use a TestRule to check for connection leaks 2019-03-06 06:21:15 -05:00
Jesse Wilson
d6daca4aa7 Assume _anon_ cipher suites are unsupported.
Closes: https://github.com/square/okhttp/issues/4588
2019-03-03 11:27:19 -05:00
Jesse Wilson
6468239d31 Merge pull request #4676 from square/jwilson.0302.oneshot
New API: RequestBody.isOneShot()
2019-03-03 07:23:22 -05:00
Jesse Wilson
0f624b52be New API: RequestBody.isOneShot()
Closes: https://github.com/square/okhttp/issues/4134
2019-03-03 07:09:05 -05:00
Amir Livneh
851e37f52a Test for connection leaks in more tests
This will help prevent regressions and point to the leaking test, rather than to a later test that happens to checks for leaks. The change is applied to all tests that have an OkHttpClient member variable.
2019-03-02 16:51:18 -05:00
Jesse Wilson
4aca390e59 Delete long-deprecated OkUrlFactory.
Some OkHttp behavior was only tested via this API, so this PR includes a bunch
of test migration. The test migration is as mechanical as possible, so we aren't
really using idiomatic APIs yet in these tests.

The `okhttp-urlconnection` survives for the JavaNetCookieJar and the
JavaNetAuthenticator. We can't remove these any time soon unfortunately.
2019-03-02 12:23:17 -05:00
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