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

3050 Commits

Author SHA1 Message Date
jwilson
51663fd08f [maven-release-plugin] prepare release parent-3.9.0 parent-3.9.0 2017-09-04 17:00:16 -04:00
Jesse Wilson
1596e57ba0 Fix some strict Javadoc HTML rules in EventListener (#3581) 2017-09-04 16:55:41 -04:00
Jesse Wilson
6fab1a323b Add a prerelease warning to EventListener (#3580) 2017-09-04 16:16:45 -04:00
Warren Smith
c323eb2814 Add 'of' to Connection JavaDoc. (#3579) 2017-09-04 14:57:35 -04:00
jwilson
2696b4a439 More changelog copy editing. 2017-09-04 14:47:53 -04:00
Jesse Wilson
b6aa9fe782 Add tests to demonstrate events bugs (#3578) 2017-09-04 02:39:46 -04:00
jwilson
c0f3652167 Copy-edit the updated changelog 2017-09-03 23:40:11 -04:00
jwilson
360b2d40ee Update the changelog for 3.9.0. 2017-09-03 23:37:08 -04:00
Jesse Wilson
3646138247 Don't summarize the request and response headers. (#3576)
Just pass the Request and Response objects in directly.
2017-09-03 19:35:56 -04:00
Yuri Schimke
6cddc8973a Close all Response in samples (#3574) 2017-09-02 11:05:43 +01:00
Jesse Wilson
33d31d073e Improve handling of HEAD requests with a Content-Length specified. (#3572)
Rather than getting the content length from a header on demand, this gets it
at the time that the RealResponseBody is created. This means that HEAD requests
can have a non-zero Content-Length header while their bodies have no content.

Closes: https://github.com/square/okhttp/issues/3365
2017-09-01 17:27:26 -04:00
Jesse Wilson
6663f063e6 The WebSocketWriter is single-threaded. (#3571)
We were synchronizing to permit multiple writer threads. But that was a carry-over
from the previous design where we supported multiple writer threads. With the
current implementation only one thread writes at a time. This synchronization
was not necessary.
2017-09-01 12:48:55 -04:00
Jesse Wilson
a95ec06a50 Fix a race in WebSocketHttpTest. (#3570)
We were assuming on a client failure the server wouldn't have any
further events. But it will get a failure if we give it a moment.
This was causing some test flakiness.
2017-09-01 12:39:24 -04:00
Jesse Wilson
77471444ec Don't report connectionAcquired until actually connected. (#3566)
Currently our implementation acquires the connection early so that we have
something to close if the call is canceled. Event listeners are simpler if
they only get a connectionAcquired event once the connection has been
actually established.
2017-09-01 01:40:37 -04:00
Jesse Wilson
6f029dd3de Fix MockWebServer websockets to be thread safe. (#3567)
Closing the sink while another thread is writing the sink is a
potential source for races.

Closes: https://github.com/square/okhttp/issues/3138
2017-08-31 21:33:47 -04:00
jwilson
9f8200d1e0 Merge branch 'jwilson.0830.charset_challenge'
* jwilson.0830.charset_challenge:
  Add charset support for RFC 7617 challenges
2017-08-31 16:26:28 -04:00
Erik Ghonyan
b3ecb0a6c9 Add charset support for RFC 7617 challenges 2017-08-31 16:18:55 -04:00
Dave Roberge
abe5d62bcf Recover from an already-allocated connection that restricts new streams. (#3525)
This is an edge case that can occur with HTTP/2. Since multiple requests
use the same connection, it's possible for one request to restrict the
connection from creating new streams during a follow-up request.

https://github.com/square/okhttp/issues/3521
2017-08-31 16:09:14 -04:00
Yuri Schimke
314b40d9c5 Failed, second connection and call.enqueue EventListener tests (#3562)
* more tests

* cleanup

* review comments

* fix flaky test
2017-08-31 03:24:26 -04:00
Jesse Wilson
a73c217717 Fix IPv6 handling for cookies (#3564) 2017-08-30 22:03:34 -04:00
Jesse Wilson
e5f50b5bc6 Fix MockWebServer handling of 'Expect: 100 Continue' (#3563)
Previously we'd skip the request body unless the socket policy was
EXPECT_CONTINUE.

Closes: https://github.com/square/okhttp/issues/3498
2017-08-30 22:03:09 -04:00
Jesse Wilson
207f5579d3 Omit the message from MockWebServer's HTTP/2 :status header (#3556)
This was a bug carried over from SPDY.

Closes: https://github.com/square/okhttp/issues/3484
2017-08-30 18:25:44 -04:00
Jesse Wilson
ee5cf50288 Update some comments to point at current RFCs (#3561)
https://github.com/square/okhttp/issues/930
2017-08-30 15:10:51 -04:00
Jesse Wilson
57891fe021 Crash early if any interceptor is null. (#3555)
Closes: https://github.com/square/okhttp/issues/3514
2017-08-30 15:00:06 -04:00
Jesse Wilson
36bd68aa3e New API, Chain.call() returns the in-flight call. (#3557)
Interceptors could use this to detect if the call has been canceled, or
cancel the call, or do other things.
2017-08-30 14:05:13 -04:00
Jesse Wilson
16f43b6439 Don't log a protocol when it is unknown. (#3558)
Closes: https://github.com/square/okhttp/issues/3395
2017-08-30 14:04:53 -04:00
Jared Burrows
1801d0cb2c update proguard rules on README.md (#3559) 2017-08-30 14:04:34 -04:00
Stuart Neivandt
c77023cd03 Test Failure in MockWebServerTest (#3547)
* Lookup the FQDN given the MockWebServer hostname to compare with the HttpUrl hostname. Issue #3546.

* Update MockWebServer to use the FQDN for its host name. Issue #3546.
2017-08-30 10:22:58 -04:00
Jesse Wilson
9b0d19f913 Don't call callEnd until after the responseBody is done (#3551) 2017-08-30 06:14:21 +01:00
Jesse Wilson
c254a9a6bf Don't fire events for Web Sockets. (#3552)
We probably want to support this, but at the moment it isn't yet
tested. Turn it off until we get something we really like.
2017-08-30 06:13:19 +01:00
Jesse Wilson
1c98464839 Move all failures into connectFailed and callFailed. (#3550)
I think applications might be simple by tracking successful events
separately from failure events.
2017-08-29 16:14:32 -04:00
Yuri Schimke
cdc48ba8b0 IOException instead of Throwable in EventListener API (#3543) 2017-08-28 12:35:03 -04:00
Yuri Schimke
3aca55d228 add fail (#3545) 2017-08-27 10:32:09 -04:00
Yuri Schimke
ee7b608745 More debug for possible but unlikely assertion failures (#3541) 2017-08-27 07:30:17 +01:00
Jake Wharton
e37c7a2993 Merge pull request #3544 from yschimke/static_class
Use a static sink class
2017-08-27 01:51:15 -04:00
Yuri Schimke
009d68db54 static sink class 2017-08-27 06:31:01 +01:00
Yuri Schimke
b52b3c78eb EventListener payload bytes and header sizes in chars (#3532)
* API in place, some tests, but some -1 sent

* typo

* header length and temporarily the request length if known

* reformat

* fix TODOs

* missing re-throw

* remove todo

* count request body bytes

* rename l -> value
2017-08-26 14:43:58 -04:00
Yuri Schimke
ec00713d5c Remove WebSocket API support for optional close code (#3540)
Remove public API support for optional close code (0)
2017-08-26 05:31:36 +01:00
jwilson
2e934cff3f Merge branch 'ifedorenko-http2-multithreaded-goaway-hang'
* ifedorenko-http2-multithreaded-goaway-hang:
  Fix occasional hang with http2 goaway frames
2017-08-14 13:44:42 -04:00
Igor Fedorenko
cd22113332 Fix occasional hang with http2 goaway frames
Http2Connection was dropping headers of healthy streams
after GOAWAY frame.

Fixes #3422

Signed-off-by: Igor Fedorenko <ifedorenko@salesforce.com>
2017-08-14 10:43:14 -04:00
Dave Roberge
7489193d59 Rename fetchStart/fetchEnd to callStart/callEnd. (#3522) 2017-08-14 07:29:28 -07:00
Nicolás Lichtmaier
da4e249b73 Allow using a charset other than UTF-8 for creating urlencoded form bodies. (#3518)
* Allow using an encoding other than UTF-8 for creating urlencoded request form bodies.

This is useful when accessing a web server you don't control which receives form data
encoded in a charset other than UTF-8 (e.g. ISO-8859-1).

To use this you pass an encoding to FormBody.Builder constructor. The constructor is used so
it's clear you shouldn't switch encodings in the middle of building a form body.

The result is undefined is a character cannot be encoded in the specified charset (as the
result of Java's String.getBytes(charset) is also undefined in that case.

* Update HttpUrl.java
2017-08-12 09:17:36 -07:00
Jesse Wilson
13d81f8d1b Test event listeners on request body failures (#3511) 2017-08-07 16:55:54 -04:00
Jesse Wilson
ed7709dbe1 Correctly report response body stream failures with HTTP/2. (#3508) 2017-08-07 09:50:16 -04:00
Yuri Schimke
dd757b6773 minor cleanup of EventListener formatting (#3509)
* minor cleanup of EventListener formatting

* remove awkward plural

* fix websocket line length
2017-08-06 17:35:02 -04:00
Adrian Pascu
bf01d510f7 Update JavaDoc for WebSocketListener (#3288) 2017-08-06 15:19:41 -04:00
Yuri Schimke
76b7d585e0 Handle h2 vs http/1.1 event ordering differences (#3504)
* Handle h2 vs http/1.1 event ordering differences

* remove sout

* additional test case

* dont change client, change server protocols

* refactor test
2017-08-06 15:19:03 -04:00
Yuri Schimke
f9de004f90 Event docs (#3505)
* Event docs

* update docs
2017-08-06 11:19:09 -04:00
Jesse Wilson
54b583ed57 Don't call EventListener methods while holding locks. (#3503) 2017-08-06 11:18:27 -04:00
Dave Roberge
d26f6bf876 Mark remaining @Nullable arguments in EventListener. (#3506) 2017-08-06 11:16:13 -04:00