1
0
mirror of https://github.com/square/okhttp.git synced 2026-01-25 16:01:38 +03:00
Commit Graph

588 Commits

Author SHA1 Message Date
Adrian Cole
68de030b35 update http2 to draft 9 and hpack to draft 5 2014-01-04 19:33:14 -08:00
Adrian Cole
d02c685a28 Merge pull request #398 from lingmingyb/timeout_issue
timeout issue
2014-01-04 18:34:21 -08:00
Adrian Cole
5395edcb11 Merge pull request #397 from lingmingyb/timeout_test
add read response header timeout case
2014-01-04 07:19:48 -08:00
lingming.yb
7c9300be5f timeout issue 2014-01-04 15:20:58 +08:00
lingming.yb
1cfab33333 add read response header timeout case 2014-01-04 12:01:48 +08:00
Jesse Wilson
139374624c Merge pull request #394 from square/jwilson_0102_headers_apis
Another round of header APIs cleanup.
2014-01-03 14:35:41 -08:00
jwilson
9417fa5c2e Another round of header APIs cleanup.
This promotes Headers to a public API from the internal package.
It moves some of its methods to OkHeaders, which has been renamed
from SyntheticHeaders.

Making the Headers class public API makes it possible to remove
more exotic APIs from Request and Response like the APIs to track
headers by index rather than by name.
2014-01-03 17:36:36 -05:00
Jake Wharton
8f04f6b17b Merge pull request #395 from square/jwilson_0102_async_redirects
Make redirects work with the async API.
2014-01-02 21:58:20 -08:00
jwilson
b21ea3a7da Make redirects work with the async API. 2014-01-03 00:52:16 -05:00
Jake Wharton
4ad28cde18 Merge pull request #393 from square/jwilson_0102_delegate_everything
Fix a bug where HTTPS POSTS were always buffered.
2014-01-02 13:12:58 -08:00
jwilson
d451e93994 Fix a bug where HTTPS POSTS were always buffered.
https://code.google.com/p/android/issues/detail?id=64348
2014-01-02 15:43:10 -05:00
Jesse Wilson
46fa5178bf Merge pull request #391 from square/jwilson_0101_headers
Remove some 'implementation detail' headers from the public API.
2014-01-02 07:23:06 -08:00
jwilson
0ef26ad2e9 Remove some 'implementation detail' headers from the public API.
Application code doesn't need to worry about headers like
'Connection' or 'Transfer-Encoding', so don't include them
in the API.
2014-01-02 10:23:09 -05:00
Adrian Cole
e2f5b474ae Merge pull request #390 from square/jwilson_0101_prepare_request
Don't let transports rewrite the request.
2014-01-01 17:17:10 -08:00
jwilson
262e3d43b6 Don't let transports rewrite the request.
Now that we're preparing Content-Length and Transfer-Encoding
before passing a request to the HTTP engine, we have no strict
need to rewrite requests in the transport.

The nice upside of this change is that the transport becomes
even less obvious when it's in place.
2014-01-01 10:53:54 -05:00
Jesse Wilson
050dfce07c Merge pull request #389 from square/jwilson_1231_killing_policy
Kill the Policy interface.
2014-01-01 07:29:30 -08:00
jwilson
dbca0acc6f Kill the Policy interface.
This interface was necessary while cleaning up the delicate
intertwined relationship between HttpURLConnection and HttpEngine.
With this change HttpEngine no longer has a reverse dependency
on HttpURLConnection.
2014-01-01 10:30:01 -05:00
Jake Wharton
bff93ffe62 Merge pull request #388 from square/jwilson_1231_send_request
Clean up around HttpEngine.sendRequest().
2013-12-31 18:05:27 -08:00
jwilson
957537774b Clean up around HttpEngine.sendRequest().
Move gateway timeout failures to CacheStrategy, and inline
methods nearby for a strict top-to-bottom flow in this method.

It becomes more obvious that the end of sendRequest has two
cases: we need a connection (opening if necessary) or we don't
need a connection (closing if necessary). Previously this was
true but not as explicit.
2013-12-31 20:52:49 -05:00
Jesse Wilson
3ed1e2a744 Merge pull request #387 from square/jwilson_1231_response_source
Improve cache strategy.
2013-12-31 15:53:51 -08:00
jwilson
29fb61cca0 Improve cache strategy.
This renames ResponseStrategy to CacheStrategy and cleans up
the code that calls into it.

This fixes a bug where we were incorrectly reporting stats
when the caller was requesting only-if-cached. In those cases
we were tracking stats before applying that constraint. Tests
for these cases have been added
2013-12-31 18:35:06 -05:00
Adrian Cole
611b00530b Merge pull request #385 from square/jwilson_1231_followup_on
Small changes to follow up on PR 384.
2013-12-31 08:41:20 -08:00
jwilson
fd0d3c93f2 Small changes to follow up on PR 384. 2013-12-31 10:39:52 -05:00
Jake Wharton
575573414e Merge pull request #384 from square/jwilson_1230_rename_raw_headers
Rename RawHeaders to Headers.
2013-12-30 23:12:58 -08:00
jwilson
4831a8dc65 Rename RawHeaders to Headers.
Now that Request and Response self-describe, I think the
word Headers is sufficient. And it's a lot less ugly than
RawHeaders.

Also move header serialization code to HttpTransport and
SpdyTransport.
2013-12-31 01:58:28 -05:00
Jesse Wilson
c3170f7fea Merge pull request #383 from square/jwilson_1230_policy
Remove more stuff from Policy.
2013-12-30 22:55:05 -08:00
jwilson
60f20dc23c Remove more stuff from Policy.
Policy is a bridge to get us from a place where HttpEngine
depends 100% on HttpURLConnection to a place where it
doesn't.

We've refactored the code in HttpEngine enough now that
some Policy methods are no longer necessary. Delete 'em.
2013-12-31 01:15:15 -05:00
Jesse Wilson
23d0b8349a Merge pull request #382 from square/jwilson_1230_requestline
Move request line and status line out of RawHeaders.
2013-12-30 22:08:23 -08:00
jwilson
bc25934830 Move request line and status line out of RawHeaders.
The request line is now standalone because it depends
on the proxy (for full URL or not) and the connection
(for HTTP version). I may change this later and put
this info in the request.

The status line now moves into Response. I have a
helper class StatusLine that does the parsing. I may
later want to hide this or make it public; I'm not
quite sure yet!

The net result is that RawHeaders is getting dumber
and used in fewer places, which is good news. This
change also shows nice simplifications to the
authenticator (which needs fewer args) and to the
tunnel builder.

Also fold together HttpsEngine and HttpEngine; the
HTTPS subclass wasn't pulling its weight.
2013-12-30 23:39:04 -05:00
Jesse Wilson
d53dae207e Merge pull request #381 from square/jwilson_1229_requestheaders
Combine Request+RequestHeaders and Response+ResponseHeaders.
2013-12-30 14:20:55 -08:00
jwilson
14b6e76e7d Combine Request+RequestHeaders and Response+ResponseHeaders.
This cleans up a lot of the unnecessary moving parts in
HttpEngine. That class is still stuck with some complexity
around request and response bodies, but it's getting better.

We're also stuck escalating the visibility of a lot of
members in Request and Response. I've got some ideas on
how to fix this; that'll have to wait for a follow up.
2013-12-30 17:08:38 -05:00
Jesse Wilson
f83688962c Merge pull request #380 from square/jwilson_1229_immutable_headers
Make RawHeaders, RequestHeaders and ResponseHeaders immutable.
2013-12-29 18:29:29 -08:00
jwilson
350c43b6fe Make RawHeaders, RequestHeaders and ResponseHeaders immutable.
This introduces a new, poorly-named class ResponseStrategy
that pulls some code out of ResponseHeaders. That was necessary
because the old method mutated itself and its parameters in
place.

Obvious follow-up for this is to combine ResponseHeaders with
Response, and RequestHeaders with Response.
2013-12-29 21:17:14 -05:00
Jake Wharton
63a278d2f4 Merge pull request #379 from square/jwilson/new_cache_api
Use Request and Response types in OkResponseCache.
2013-12-29 16:06:54 -08:00
jwilson
30ecba897f Use Request and Response types in OkResponseCache.
This breaks support for java.net.ResponseCache implementations. That's
good. That API is akward and can't support important features like
conditional GETs and hit tracking.
2013-12-29 18:57:35 -05:00
Jesse Wilson
f2d3e0f92c Merge pull request #378 from square/jwilson/handshake
Introduce Handshake as a value object.
2013-12-28 21:40:08 -08:00
jwilson
e2bfa5dd6c Introduce Handshake as a value object.
I needed a non-terrible way to provide the HTTPS handshake
information to the async API. Previously we were passing the
live socket around, which was leaky and gross.

This creates a new value object that captures the relevant
bits of the handshake. We can use it in the response, the
connection, and also in the cache. It's plausible that in
the future we can use it to allow the application to block
requests if the handshake is insufficient.
2013-12-29 00:35:14 -05:00
Jesse Wilson
fa11baea6d Merge pull request #377 from square/jwilson/async_apis
Define async APIs and switch Job to use HttpEngine directly.
2013-12-28 17:47:14 -08:00
jwilson
37c01895cc Define async APIs and switch Job to use HttpEngine directly.
Using HttpEngine directly introduces some duplicated code with
HttpURLConnection. It also breaks the response cache. I think
this is the best route going forward; and eventually we could
invert this relationship to have HttpURLConnection depending on
Job directly rather than vice versa.
2013-12-28 20:24:42 -05:00
Adrian Cole
f0fc449f9a Merge pull request #376 from lingmingyb/mtu
getMtu issue
2013-12-28 09:29:48 -08:00
lingming.yb
1c90331a3d getMtu issue 2013-12-28 13:30:22 +08:00
Adrian Cole
5dc27c7172 Merge pull request #374 from lingmingyb/wrapper
Buffered Stream wrapper should be taken place before SpdyConnection buil...
2013-12-25 06:14:07 -08:00
lingming.yb
b9c3ffb26a format 2013-12-24 10:43:38 +08:00
lingming.yb
35ead0f5d1 extract a method 2013-12-23 17:02:52 +08:00
lingming.yb
13c06879f4 Buffered Stream wrapper should be taken place before SpdyConnection build. 2013-12-22 11:22:12 +08:00
Jake Wharton
29f48ef7d9 Merge pull request #368 from nacx/mock-patch
Support PATCH requests in MockWebServer
2013-12-13 09:12:37 -08:00
Ignasi Barrera
d0e49527c7 Support PATCH requests in MockWebServer 2013-12-13 17:35:05 +01:00
Adrian Cole
514ae5478c Merge pull request #366 from adriancole/fix-hpack
MockWebServer can now read headers sent by http2 clients
2013-12-09 09:31:56 -08:00
Adrian Cole
4db7288561 Adjust hpack impl to be compliant with draft 3 examples, and enable http2 in MWS. 2013-12-08 21:54:06 -08:00
Jesse Wilson
a6d63eb816 Merge pull request #365 from adriancole/spdy-post-content-length
set content-length on spdy post
2013-12-07 16:55:52 -08:00