1
0
mirror of https://github.com/square/okhttp.git synced 2026-01-27 04:22:07 +03:00
Commit Graph

164 Commits

Author SHA1 Message Date
Jake Wharton
72cdfed12d Merge pull request #91 from square/jwilson/redirect_retry
Retry if a request fails after a redirect.
2013-01-30 21:10:02 -08:00
jwilson
637783ce8a Retry if a request fails after a redirect.
https://code.google.com/p/android/issues/detail?id=41576
2013-01-31 00:05:20 -05:00
Jake Wharton
fc232eb27c Merge pull request #89 from square/jwilson/cookies
Fix cookies for SPDY transport.
2013-01-23 09:02:59 -08:00
jwilson
989652fe06 Fix cookies for SPDY transport. 2013-01-23 11:43:23 -05:00
Jake Wharton
c029803933 Merge pull request #88 from square/jwilson/more_tests
Improve SPDY+HTTP integration.
2013-01-22 13:37:12 -08:00
jwilson
194290e5f3 Improve SPDY+HTTP integration.
Writing tests shook out a few bugs:
 - Pooling wasn't working well. We were trying to connect
   after already having been connected.
 - We weren't writing response bodies to the cache.
 - We weren't capturing the request time for the cache.
 - MockSpdyServer wasn't trimming headers.

New files in this change aren't new, they're just inner classes promoted
to top-level classes for better sharing.
2013-01-22 16:14:52 -05:00
Jesse Wilson
383b49df9d Merge pull request #87 from square/jwilson/mockspdyserver
Introduce MockSpdyServer.
2013-01-22 10:39:12 -08:00
jwilson
3a0874cb22 Introduce MockSpdyServer.
This is like MockWebServer, but it speaks SPDY behind the scenes
instead of HTTP. The goal with this change is to make it very easy
to test interactions between SPDY and HTTP features like cookies,
fault tolerance and caching.
2013-01-22 13:38:38 -05:00
Jesse Wilson
514fbfd5f0 Merge pull request #86 from square/jwilson/careful
Be more careful around IOExceptions.
2013-01-21 11:42:47 -08:00
jwilson
b9580d68e9 Be more careful around IOExceptions.
This adds a first test where a frame is truncated. That has some
unpleasant consequences for the other tests because it means the
MockSpdyPeer is more aggressive about closing the socket when all
frames have been sent.

It also reduces the use of exceptions for flow control when handling
bogus incoming frames. This is a bit worse and a bit better; my
goal is to make it easier to differentiate between protocol-level
problems (bogus frames) from transport-level problems (closed sockets
and EOF streams).
2013-01-21 14:42:08 -05:00
Jake Wharton
c37a793573 Merge pull request #85 from square/jwilson/receive_window_update
Implement flow control for the outgoing stream.
2013-01-18 14:14:58 -08:00
jwilson
1bd9fefb51 Implement flow control for the outgoing stream.
We had a bug where we were using spdy/2's layout for
setting frames rather than spdy/3's layout. I discovered
this when testing flow control against Chrome.

This fixes uploads greater than 64 KiB.
2013-01-18 15:50:22 -05:00
Jake Wharton
8571b0cbd2 Merge pull request #84 from square/jwilson/send_window_update
Implement flow control for the incoming stream.
2013-01-18 11:00:49 -08:00
jwilson
b1c592d7c9 Implement flow control for the incoming stream.
This sends a WINDOW_UPDATE frame whenever the total number of
unacknowledged bytes exceeds 32 KiB. This is a simple policy;
we could tune it to be more sophisticated as necessary.

This fixes downloads of streams greater than 64 KiB.
2013-01-18 12:52:22 -05:00
Jesse Wilson
4e1dd18f07 Merge pull request #80 from square/jwilson/spdy3
Upgrade from spdy/2 to spdy/3.
2013-01-06 15:33:32 -08:00
jwilson
06579c5bfb Upgrade from spdy/2 to spdy/3. 2013-01-06 18:30:16 -05:00
edenman
34ea44bc1d Merge pull request #79 from square/jwilson/tls_modes
Turn  makeTlsTolerant into two methods.
2013-01-03 11:50:10 -08:00
jwilson
43f7cae330 Turn makeTlsTolerant into two methods.
See https://android-review.googlesource.com/48700
2013-01-03 12:37:39 -07:00
Jake Wharton
d64aef95a6 Merge pull request #78 from square/jwilson/flatten
Flatten internal packages and utility classes.
2013-01-01 20:20:33 -08:00
jwilson
689f66222b Flatten internal packages and utility classes.
The previous structure had hierarchy that was useful
for libcore but overkill for OkHttp.
2013-01-01 20:50:06 -07:00
Jake Wharton
73516e6ab1 Merge pull request #77 from square/jwilson/headers
Support the HEADERS frame.
2013-01-01 19:27:22 -08:00
jwilson
7a28500a72 Support the HEADERS frame. 2013-01-01 20:21:26 -07:00
Jake Wharton
f740f1f987 Merge pull request #76 from square/jwilson/spdyserver
Use TLS + NPN in SpdyServer.
2013-01-01 16:24:32 -08:00
Jake Wharton
e9f1e3ccdd Merge pull request #75 from square/jwilson/timeouts
Make timeouts work for SPDY.
2013-01-01 14:14:30 -08:00
jwilson
0c55008645 Use TLS + NPN in SpdyServer.
This server is able to serve content to Chrome, after
dismissing the 'untrusted server' warning.
2013-01-01 10:39:43 -07:00
jwilson
86e5c34846 Make timeouts work for SPDY.
We can't use the regular socket timeouts because the
socket is shared. Moving it to the application level
is more complicated, but it allows different streams
to set timeouts independently.
2013-01-01 00:54:58 -07:00
Jake Wharton
7b35a0d86c Merge pull request #74 from square/jwilson/close
Implement SpdyConnection.close().
2012-12-31 20:28:18 -08:00
jwilson
b5719b6d7f Implement SpdyConnection.close(). 2012-12-31 20:41:15 -07:00
Jake Wharton
8c281b2fc7 Merge pull request #73 from square/jwilson/open
Discard streams once they're no longer open.
2012-12-31 18:03:12 -08:00
jwilson
7f42496259 Discard streams once they're no longer open.
This avoids a memory leak; we don't hold onto the input stream
and it's large 64 KiB buffer long after that stream is done.

It also allows SpdyConnection to track how many streams are
currently active. This will allow a follow up change to shut
down connections that don't host any streams.
2012-12-31 18:55:43 -07:00
Jake Wharton
a52eaa4ee6 Merge pull request #72 from square/jwilson/goaway
Implement GOAWAY, for clean shutdowns of SPDY connections.
2012-12-30 23:43:35 -08:00
jwilson
60d5852c66 Implement GOAWAY, for clean shutdowns of SPDY connections.
Also clean up some SPDY headers and improve error messages.
2012-12-31 00:35:27 -07:00
Jake Wharton
bc342a42c8 Merge pull request #71 from square/jwilson/errors
Improve SPDY error handling and concurrency.
2012-12-29 22:23:16 -08:00
jwilson
768059cfc4 Improve SPDY error handling and concurrency. 2012-12-29 22:36:45 -07:00
Jake Wharton
2c6be53791 Merge pull request #69 from square/jwilson/junit4
Unsuppress tests and upgrade to JUnit 4.
2012-12-29 13:38:32 -08:00
Jake Wharton
8b574cb48e Merge pull request #70 from square/jwilson/synch
Fix synchronization todos in SpdyStream.
2012-12-29 13:34:13 -08:00
jwilson
e4a4cbae4f Fix synchronization todos in SpdyStream.
This code had bugs where ongoing reads could prevent
writes from occurring. This update adds some asserts
to prevent synchronization errors.
2012-12-29 13:42:52 -07:00
jwilson
dca5d83027 Upgrade to JUnit 4.
Primary motivation is to gain access to @Ignore, for some
tests that haven't yet been written, or that don't work on
the RI (due to RI bugs).
2012-12-29 11:10:13 -07:00
jwilson
e3b90752dd Unsuppress some tests.
These were suppressed because they needed a bit of
work; I did that work and now they pass.
2012-12-27 23:15:42 -07:00
Jake Wharton
d10c20a7eb Merge pull request #67 from square/jwilson/libcore
Clean up utility code for submission to AOSP.
2012-12-26 15:08:40 -08:00
jwilson
67604f618d Clean up utility code for submission to AOSP.
This moves methods that will have Android-specific implementations
to Platform.java; all other utility methods are in a junk drawer
class called Utils.java.

This also moves method names (like "GET") to compare with .equals
instead of '=='. The old code took advantage of a hidden agreement
between HttpURLConnection and HttpEngine; with these in separate
projects that behavior isn't as obvious and shouldn't be relied
upon.
2012-12-26 11:31:25 -07:00
Jake Wharton
d2f4f21654 Merge pull request #66 from square/jwilson/new_apis
Promote Connection, ConnectionPool and Address APIs.
2012-12-23 21:47:29 -08:00
jwilson
78c6624b11 Promote Connection, ConnectionPool and Address APIs.
This moves HttpConnection.Address and HttpConnection.TunnelConfig
to their own top-level classes.
2012-12-24 00:39:48 -05:00
Jake Wharton
73291e89c4 Merge pull request #65 from square/jwilson/connection
Prepare to promote HttpConnection + Pool to public API.
2012-12-23 13:38:56 -08:00
jwilson
70e64037ff Prepare to promote HttpConnection + Pool to public API.
Giving the application code access to the connection pool
is tricky: it exposes more implementation details from
OkHttp; details that are quite inaccessible through the
conventional HttpURLConnection APIs. Currently the only
thing regular users get are a pair of awkward system
properties.

But exposing these should also be useful: it'll allow the
application to observe the pool (for performance monitoring)
and possibly also to directly manage it (by setting policy,
or to evict when the application is paused).
2012-12-22 18:05:27 -05:00
Jake Wharton
6579f9d974 Merge pull request #63 from square/jwilson/fewer_casts
Move the SSL socket factory and hostname verifier to the client.
2012-12-22 11:16:18 -08:00
Jake Wharton
ccb887c758 Merge pull request #64 from square/jwilson/tls_caching_tests
Restore tests for response caching + TLS.
2012-12-22 11:14:50 -08:00
jwilson
3d2547f188 Restore tests for response caching + TLS.
One of the test cases bitrotted to failure as a consequence
of the HTTP route selector change. I stopped assigning the
socket, which it needed to cache the TLS metadata. This is
fixed.
2012-12-22 13:40:29 -05:00
jwilson
7bcdc338d6 Move the SSL socket factory and hostname verifier to the client.
This saves clients from needing to cast to HttpsURLConnection
to expose the HTTPS-only accessors.
2012-12-22 12:43:27 -05:00
Jake Wharton
a7258910fa Merge pull request #61 from square/jwilson/fewer_statics
Move system-wide statics to the OkHttpClient class.
2012-12-21 19:52:57 -08:00