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

146 Commits

Author SHA1 Message Date
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
Patrick Forhan
3deadab31b Merge pull request #59 from square/jwilson/improve_reuse
Improve connection reuse.
2012-12-07 07:48:39 -08:00
Jesse Wilson
04d742bd3d Improve connection reuse.
Instead of trying to read the last bytes of a content body
when the input stream is read, do it when the connection is
closed. This approach is less elegant, since it requires
a connection to do work on behalf of a potentially nonexistent
follow up connection. But it should result in more reuse in
practice.

http://code.google.com/p/android/issues/detail?id=38817
2012-12-06 21:06:45 -05:00
Jake Wharton
f3d956e25b Merge pull request #58 from square/jwilson/checkstyle
Fix checkstyle issues.
2012-12-03 08:19:48 -08:00
Jesse Wilson
bbea4aaa6f Fix checkstyle issues. 2012-12-03 11:18:53 -05:00
Jake Wharton
8ab9438c70 Merge pull request #56 from square/jwilson/platform-api
New API to break platform-specific dependencies.
2012-11-14 00:31:39 -08:00
Jesse Wilson
9a1da9b420 New API to break platform-specific dependencies.
In particular:
 - Don't require OkHttp to depend on Jetty's non-boot package for
   Android. This was causing ugly, confidence-smashing dalvik
   errors in Android apps.
 - Don't prevent HTTP on Java6 just because SPDY isn't available.

This uses gross reflection and dynamic proxies! That's sad, but
it's encapsulated so users won't have to know it exists.
2012-11-13 23:12:12 -05:00
edenman
6991363c38 Merge pull request #55 from square/jwilson/npe-due-to-badhostname
Don't explode if DNS fails or if the address is malformed.
2012-11-12 12:39:02 -08:00
Jesse Wilson
084fa33870 Don't explode if DNS fails or if the address is malformed.
We had a bug where we were trying to report a proxy problem
before the connection was even created.
2012-11-12 12:34:05 -08:00
Jake Wharton
6af7cd22b3 Merge pull request #54 from square/jwilson/reconnect
Don't drop out of connect if the first request fails.
2012-11-11 12:53:55 -08:00
Jesse Wilson
51e5320e7b Don't drop out of connect if the first request fails.
This fixes a break caused by the recent try-harder-on-IP-addresses
change, where if the first connect failed we returned rather than
trying until we reached a connection or an error.
2012-11-11 12:45:50 -08:00