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

3136 Commits

Author SHA1 Message Date
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
Yuri Schimke
f23067f6cc fix javadoc link (#3823)
"mvn javadoc:jar" failing because of an invalid link.  Previous fix was a workaround to skip the failure.
2018-02-04 23:17:37 +00:00
Yuri Schimke
18f3564a4f Update deploy_snapshot.sh to temporarily ignore javadoc errors and compile tests but not run (#3821) 2018-02-04 20:52:03 +00:00
Yuri Schimke
2d71309d94 Check for invalid index to avoid IOOBE (#3819)
* Check for invalid index to avoid IOOBE

* passing test

* Update Hpack.java
2018-02-04 11:41:13 -05:00
Yuri Schimke
d27531afa9 Use manifest entry for java 9 module name (#3743)
* Use manifest entry for java 9 module name

* add group

* specific names

* Update pom.xml

* Update pom.xml

* Update pom.xml

* Update pom.xml

* Update pom.xml

* Update pom.xml

* Update pom.xml

* Update pom.xml
2018-02-04 03:02:20 -05:00
Yuri Schimke
9cb3af2a03 Build Provider through the Platform (#3788) 2018-01-28 17:04:42 +00:00
Yuri Schimke
8f56e81f93 Reset stream after a rollover (#3752)
* Fail requests that roll over stream id

* revert bad starting id

* alternate implementation
2018-01-28 11:42:37 -05:00
Matt Sheppard
bb304b9c2c Log gzipped bodies when HttpLoggingInterceptor is used as a NetworkInterceptor (#3792)
* (in-progress) Support gzipped bodies as a networkInterceptor

* Fixed buffer cloning, added test for a still-unsupported encoding (Brotli)

* Avoid try-with-resources and too-long lines to appease build checks

* Fixed method name typo

* Added suggested comma between byte and gzipped-byte count

* Account for added comma in test

* Use buffer.writeAll to ensure all body content is read

* Indentation consistency

* Added test to confirm response body remains valid
2018-01-28 11:33:00 -05:00
Jake Wharton
17b5dbbe14 Merge pull request #3755 from yschimke/npe
NPE earlier in FormBody.Builder
2018-01-28 10:41:04 -05:00
Yuri Schimke
40b42384b2 Add new JDK versions (#3803)
Add new JDK versions for alpn-boot 8.1.12.v20180117
2018-01-28 15:25:01 +00:00
Jake Wharton
a15519d09e Do not count web sockets toward per-host limit. (#3802) 2018-01-27 09:10:31 -05:00
Eric Cochran
8c5283797b Mark some EventListener parameters as non-null. (#3799) 2018-01-26 04:18:06 -05:00
Erik Ghonyan
8e1e9078c8 Rename userName parameter to username in Credentials (#3781) 2018-01-17 09:51:12 -05:00
cketti
8c9c134ab1 Allow request bodies for all HTTP methods except GET and HEAD (#3777) 2018-01-14 12:12:19 -05:00
Tobias T
cd84d79c35 OkHostnameVerifier: Don't fall back to CN verification. (#3764)
The use of Common Name was deprecated in RFC 2818 (May 2000), section 3.1:

  Although the use of the Common Name is existing practice, it is
  deprecated and Certification Authorities are encouraged to use the
  dNSName instead.

In 2017, Chrome 58, Firefox 48, and Opera 45 web browsers removed this
fallback, with Chrome leaving it configurable for enterprise deployments
(see https://www.chromestatus.com/feature/4981025180483584).
Android is removing it in http://r.android.com/581382 .
2018-01-05 18:54:59 -05:00