1
0
mirror of https://github.com/square/okhttp.git synced 2026-01-15 20:56:41 +03:00
Commit Graph

3150 Commits

Author SHA1 Message Date
Jesse Wilson
e593e2e163 Merge pull request #3960 from square/http2-connection-flow-control
Defer StreamResetException until response body buffer is fully read.
2018-04-11 22:24:36 -04:00
Dave Roberge
b35ad1bcd1 Fixed flaky CallTest.cancelImmediatelyAfterEnqueue. (#3961)
Closes: https://github.com/square/okhttp/issues/3854
2018-04-11 22:14:33 -04:00
Dave Roberge
691a82b58e Defer StreamResetException until response body buffer is fully read.
We rely on the application layer to read the response body buffer
before sending WINDOW_UPDATE's. Previously we'd immediately throw a
StreamResetException. This prevented the application layer from reading
the buffer which in turn means we would not send WINDOW_UPDATE's. This
has potential to deplete the flow-control window.

https://github.com/square/okhttp/issues/3915
2018-04-08 15:27:05 -04:00
Dave Roberge
878bde8fd6 Do not alter connection flow-control window on SETTINGS frame. (#3920)
This might have been a difference between SPDY and HTTP/2. Reviewing the
HTTP/2 spec, only a WINDOWS_UPDATE frame can change the flow-control
window for a connection.
2018-03-19 22:36:24 -04:00
Eric Cochran
5fe3cc2d08 OkHttpClient.cache() is nullable. (#3916) 2018-03-06 22:26:55 -05:00
Yuri Schimke
69bdd6961b Restricted ciphers (#3908)
Add a "best practice" restricted TLS connection spec
2018-03-04 12:57:14 +00:00
Yuri Schimke
2864001d99 Avoid flaky test using pushExecutor after shutdown (#3900) 2018-03-01 08:03:34 +00:00
Andrew Shu
0b74bba088 Readme: Update version, add ProGuard for Conscrypt (#3901)
For OkHttp 3.10.0
2018-02-28 05:33:36 -05:00
Carter Kozak
c3d6607a14 fix #3895: Set Conscrypt.setUseEngineSocket per SocketFactory (#3896)
This change avoids static configuration which may cause issues
for applications using both OkHttp and HttpsUrlConnections.
2018-02-28 05:32:50 -05:00
Jaye Pitzeruse
9a6f88dc34 gh-1019: Implemented prior knowledge approach to h2c (#3873) 2018-02-26 23:55:10 +00:00
Yuri Schimke
adb2a82049 Dont System.exit the test runner (#3888)
* Dont System.exit

* Maven aware uncaught exception handling

* cleanup
2018-02-25 22:32:03 -05:00
Jake Wharton
25d306ca76 Merge pull request #3889 from square/jwilson.0225.https_links
Use HTTPS links in documentation where possible.
2018-02-25 22:19:03 -05:00
Jesse Wilson
ff32c38d2c Use HTTPS links in documentation where possible. 2018-02-25 22:06:34 -05:00
Jesse Wilson
e86eb0e48b [maven-release-plugin] prepare for next development iteration 2018-02-24 13:33:57 -05:00
Jesse Wilson
c0739a4199 [maven-release-plugin] prepare release parent-3.10.0 parent-3.10.0 2018-02-24 13:33:52 -05:00
Jesse Wilson
91b1b671fc Release writer threads when the connection is shut down. (#3886)
Otherwise these threads stick around forever. Yikes.
2018-02-23 23:03:46 -05:00
Jesse Wilson
cce5ca8aed Unexpected pongs shouldn't interfere with our ping interval. (#3881)
Rather than tracking how many have been received, just track whether we're
still awaiting a reply.
2018-02-23 22:04:56 +00:00
Jesse Wilson
7704df6f9c Give the changelog more details on using Conscrypt. 2018-02-23 10:06:36 -05:00
Jesse Wilson
b8806e284c Update changelog for 3.10.0. 2018-02-22 23:27:02 -05:00
Jesse Wilson
af6198a1e9 Fail HTTP/2 connections if the pong is not received. (#3878)
This removes the Ping abstraction from our http2 package. This was written as
if it were a public API, but never exposed to any callers but tests. Removing
it makes it easier to lock down how pings are used.

This also removes the NullServer class, replacing it with a new SocketPolicy
on MockWebServer. The new SocketPolicy, STALL_SOCKET_AT_START, allows us to
do TLS and negotiate an HTTP/2 connection without actually building a proper
Http2Connection and without responding to pings.

The behavior in HTTP/2 connections is modeled after our behavior in web sockets.
We count outgoing pings, incoming pongs, and confirm that the pongs are keeping
up. If later we make this policy more sophisticated we can track the changes
in both places.

Closes: https://github.com/square/okhttp/issues/3261
2018-02-22 18:37:34 -05:00
Jesse Wilson
b6e32b4fb0 Merge branch '15characterlimi-null-sslsocketfactory'
* 15characterlimi-null-sslsocketfactory:
  First step towards HTTP/2 automatic pings. (#3874)
  Fix swapped name and value tests. (#3877)
  OkHttpsURLConnection.setSSLSocketFactory(null): throw.
2018-02-21 20:19:14 -05:00
Jesse Wilson
27c8a79302 First step towards HTTP/2 automatic pings. (#3874)
This changes the executor services in HTTP/2 connection to split up
listener executors (of which there may be many threads) from writer
executors (of which there is one per connection).

This adds a scheduled executor job to send pings on an interval. We
don't yet fail the connection if pongs are not received.

For follow-up there's some work to remove exising APIs to send pings
through the HTTP/2 APIs. These are unused and make it awkard to
confirm that only the automatic pings are being replied to.

See https://github.com/square/okhttp/issues/3261
2018-02-21 20:19:08 -05:00
Eric Cochran
7d67e37da7 Fix swapped name and value tests. (#3877) 2018-02-21 20:18:21 -05:00
Jesse Wilson
abb0a79080 First step towards HTTP/2 automatic pings. (#3874)
This changes the executor services in HTTP/2 connection to split up
listener executors (of which there may be many threads) from writer
executors (of which there is one per connection).

This adds a scheduled executor job to send pings on an interval. We
don't yet fail the connection if pongs are not received.

For follow-up there's some work to remove exising APIs to send pings
through the HTTP/2 APIs. These are unused and make it awkard to
confirm that only the automatic pings are being replied to.

See https://github.com/square/okhttp/issues/3261
2018-02-21 20:17:09 -05:00
Eric Cochran
2edbff4481 Fix swapped name and value tests. (#3877) 2018-02-21 20:16:14 -05:00
Tobias Thierer
f704f9d30e OkHttpsURLConnection.setSSLSocketFactory(null): throw.
OkHttpsURLConnection extends javax.net.ssl.HttpsURLConnection.
The super class documentation says that setSSLSocketFactory(null)
throws IllegalArgumentException, but this implementation didn't
do that.

This CL fixed OkHttpsURLConnection.setSSLSocketFactory(null) to
throw, as specified.

Test: not done locally, relying on Travis.
2018-02-21 11:05:02 +00:00
Arlo Breault
3f3aebac5b Fix Builder.proxy doc (#3871)
Should have been part of 38d570a
2018-02-20 15:03:00 -05:00
Jesse Wilson
6c66d6c41b Fail web sockets if the pong is not received (#3870)
There are several options for when to expect the pong response. I've
chosen to overload the ping interval. This seems reasonable because the
ping interval is the maximum amount of time that should elapse before
a connection failure is detected.

Closes: https://github.com/square/okhttp/issues/3227
2018-02-20 15:02:29 -05:00
Jesse Wilson
64df392216 Don't hold a lock on the connection when writing settings. (#3867)
This breaks our concurrency rules. Fortunately it's only academic; only
MockWebServer ever writes settings, and it only does so in very specialized
tests.
2018-02-19 18:04:29 -05:00
Jesse Wilson
cb43dbddcc The EventListener API still isn't final (#3866) 2018-02-19 16:49:47 -05:00
Jake Wharton
ebe70e20b0 Merge pull request #3864 from square/jwilson.0219.cipher_suites
Remove CBC-mode ECDSA cipher suites
2018-02-19 15:07:54 -05:00
Jesse Wilson
ea014716fd Remove CBC-mode ECDSA cipher suites
This removes the following cipher suites as supported-by-default:
  TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
  TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA

This tracks a similar change in Chromium 56:
  https://developers.google.com/web/updates/2016/12/chrome-56-deprecations#remove_cbc-mode_ecdsa_ciphers_in_tls

OkHttp's updated cipher suites, plus comparisons to Android, Java,
Chromium, Firefox, and Square's server-site configuration is here:
  https://tinyurl.com/okhttp-cipher-suites

Closes: https://github.com/square/okhttp/issues/3035
2018-02-19 14:35:39 -05:00
Jesse Wilson
9a7b6715d7 Encode more characters when using addQueryParameter(). (#3863)
Though it's good for OkHttp to retain the user's provided encoding, we
should be encoding more characters than we are when the user provides
us with unencoded data.

Closes: https://github.com/square/okhttp/issues/3235
2018-02-19 13:26:15 -05:00
Yuri Schimke
4c462ff834 More lenient test involving logging (#3859)
* reproduce failing test

* More lenient tests because logging is JVM wide

* hide logging
2018-02-18 13:40:56 -05:00
Eric Cochran
2db8c41b3b Move and test toHumanReadableAscii. (#3851) 2018-02-18 06:57:59 -05:00
Eric Cochran
8a206cece6 Add doc for Request.Builder.removeHeader. (#3858)
to note multiple headers may be removed.
2018-02-18 07:16:17 +00:00
Yuri Schimke
14215b8b3f cleanup travis output (#3853) 2018-02-17 09:25:41 -05:00
Johan von Forstner
e5fa0b989e Handle 100 (Continue) HTTP response gracefully regardless of whether it was requested/expected (#3766)
* Add a failing test for handling 100 response when it was not requested
(#3628)
* Implement reading the correct response after unrequested 100-continue
2018-02-17 11:21:40 +00:00
Yuri Schimke
19726969aa Conscrypt Support (#3262)
Support for Conscrypt when installed as top priority security provider prior to first use of Platform.
2018-02-17 10:24:27 +00:00
Jake Wharton
0a4896a296 Transfer to/from FileChannel directly from Buffer. (#3846) 2018-02-14 00:43:38 -05:00
Jake Wharton
7d6b4d734a Merge pull request #3845 from yallam08/fix_documentation_extra_semicolon
documentation extra semicolon
2018-02-13 12:05:14 -05:00
Yahia Allam
a40d227d5d documentation extra semicolon 2018-02-13 17:07:37 +02:00
Jake Wharton
2e85e1ecf7 Use UnsafeCursor to XOR web socket data. (#3843) 2018-02-12 22:36:09 -05:00
Jake Wharton
de806892e3 Small web socket optimizations. (#3841)
* Eliminate redundant boolean.

* Force batch web socket emissions to underlying sink.

Write directly into the sink's buffer so that we can ensure there are no accidental emissions to the buffered sink's underlying sink. Since we always call flush() or emit() at the end of these methods anyway, accidental intermediate emissions don't have any performance value.

* Private.

* Remove unused constants.

* Initialize byte arrays for masking only when needed.

* Move frame byte read count to locals.

* Re-use Buffer instances for control and message frames.

* Remove test dependency on implementation code.

Previously the test used logic that was part of the code under test to validate behavior. This means that a bug would be missed as the behavior would be present in the actual and expected data. By using golden binary hex values, we are insulated from this.
2018-02-12 06:38:31 -05:00
Jesse Wilson
9212929c63 Don't pass a null route to the authenticator. (#3840)
Closes: https://github.com/square/okhttp/issues/3809
2018-02-11 19:29:19 +00:00
Jesse Wilson
d0418379a7 Move MockWebServer's internal package to not collide with OkHttp's. (#3837)
Hoping this may prevent problems with the Java Platform Module System.
2018-02-09 06:20:57 +00:00
Jesse Wilson
0aa5723dc8 Make RetryAndFollowUpInterceptor.streamAllocation volatile. (#3836)
It was possible for a call to cancel() to not cancel because the canceling
thread wouldn't observe the streams.

I've added a local StreamAllocation variable to avoid extra volatile reads.

Closes: https://github.com/square/okhttp/issues/3834
2018-02-09 06:20:21 +00:00
Jake Wharton
fb284d3508 Merge pull request #3829 from mic-/responsebody_documentation_fix
Fix typo in ResponseBody documentation
2018-02-06 12:49:07 -05:00
mic-
e0b9d4964c Fix typo in ResponseBody documentation 2018-02-06 18:38:10 +01:00
Yuri Schimke
740dfbafcc build javadoc and source jars in normal build to flush out build failures (#3824) 2018-02-04 20:10:00 -05:00