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

156 Commits

Author SHA1 Message Date
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
edenman
1ef490fe11 Merge pull request #62 from square/jwilson/commented_tests
Clean up commented out URLConnection tests.
2012-12-21 14:11:58 -08:00
jwilson
1c9cb2a0c2 Clean up commented out URLConnection tests.
There were some tests that only work on Dalvik/Linux: the CloseGuard
test and the timeout test rely on Linux-specific behavior that's too
flaky for a general test.

The TrustManager test just needed some attention and simplification to
work on both the JDK and Dalvik TLS stacks.
2012-12-21 16:28:13 -05:00
jwilson
1a1e1b7e2d Move system-wide statics to the OkHttpClient class.
This makes it possible to have two HttpClient instances that
don't share cookies or response cache policy. For example, a
program that makes both REST calls and downloads images may
prefer different response caches for each type of resource.
2012-12-21 11:39:24 -05:00
Jake Wharton
470c7f5986 Merge pull request #60 from square/jwilson/aosp
Prepare to use OkHttp to back HttpURLConnection in AOSP
2012-12-17 17:10:11 -08:00
jwilson
c9d183636d Bump the version number for backwards-incompatible changes. 2012-12-17 19:30:00 -05:00
jwilson
cb5a9a4ea3 Remove some dead code. 2012-12-15 17:09:11 -05:00
jwilson
50999cceb5 Move out of the libcore package.
To promote the code into AOSP, we'll keep this package as-is
and do the jarjar in Android instead.
2012-12-15 16:55:10 -05:00
jwilson
7f7aa90bc5 Switch to a builder for HttpURLConnection instances.
The builder has two upsides:
 - It allows us to use the same base classes from java.net
   as the base API.
 - It gives us a place to stash configuration in a place other
   than static fields. This will be useful for the connection
   pool, cookie manager, response cache, etc.
2012-12-15 16:17:18 -05:00