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

63 Commits

Author SHA1 Message Date
jwilson
3a21915069 Drop obsolete imports.
These crept in after rebase.
2014-01-19 23:53:16 -05:00
Jesse Wilson
14e87e8d8a Merge pull request #461 from square/jwilson_0119_more_cache_headers
Move more cache headers out of public API.
2014-01-19 20:49:50 -08:00
jwilson
c1458f74d8 Move more cache headers out of public API. 2014-01-19 23:19:14 -05:00
Adrian Cole
4a627bb009 Change spdy and http/2 headers to always lowercase. Introduce allocation-free ByteString.equalsAscii. 2014-01-19 20:18:49 -08:00
jwilson
27463b509f Synchronize when acking settings.
Without this tests fail.
2014-01-19 23:08:27 -05:00
Adrian Cole
b95a0ccbca Top-level immutable, internal HeaderEntry class to reduce duplication around header names. Do not emit :version in http/2. 2014-01-19 10:35:34 -08:00
Adrian Cole
8da2510c3c Reduce allocation for HPACK decompression. 2014-01-18 23:37:28 -08:00
Adrian Cole
7fccb687b2 In HPACK, specifying the index of an referenced entry dereferences it. 2014-01-18 21:20:13 -08:00
Adrian Cole
ef30f7efc6 Extract default settings to variants. Read windowSize (spdy/3) and headerTableSize (http/2) from peer. 2014-01-18 20:46:50 -08:00
Adrian Cole
5843bd35bd fix #447: Fix JettyNpnProvider.invoke() to pick the right protocol 2014-01-18 10:31:28 -08:00
Adrian Cole
bfa2788032 fix #447: Fix JettyNpnProvider.invoke() to pick the right protocol 2014-01-18 09:52:20 -08:00
Adrian Cole
04e1002ad1 Support more than 64 referenced headers in HPACK. 2014-01-17 13:53:13 -08:00
Adrian Cole
b50c9c6540 Merge pull request #453 from square/jw/bit-array
Introduce BitArray, a simple BitSet clone that supports shifting.
2014-01-17 13:17:11 -08:00
Jake Wharton
ce40dc702d Introduce BitArray, a simple BitSet clone that supports shifting. 2014-01-17 12:05:55 -08:00
Adrian Cole
9766de54dc consolidate protocol constants 2014-01-16 08:39:31 -08:00
jwilson
46a0852c20 Don't attempt TLS modes we know will fail.
https://github.com/square/okhttp/issues/442
2014-01-16 08:28:02 -05:00
jwilson
a8e2f930ea Support ALPN on Android 4.4+.
ALPN is the successor to NPN. When it's widely deployed we
can drop support for NPN altogether.

Verified manually on my Android device against https://gmail.com
(which uses ALPN) and https://twitter.com (which uses NPN only).

https://github.com/square/okhttp/issues/128
2014-01-12 22:39:09 -05:00
jwilson
5c84000ca3 Flatten Android platforms.
In preparation for addition of ALPN, which would add a
third class, where inheritance starts to break.
2014-01-12 21:37:06 -05:00
jwilson
749a65b776 Use thread names everywhere.
Sometimes we name a thread both via its ExecutorService
and via a NamedRunnable. The ExecutorService thread needs
to be named because threads are cached and will be visible
in a thread dump even when no runnables are running.

NamedRunnables are also used because they provide additional
context: the host or URL being serviced by a thread.
2014-01-12 09:47:56 -05:00
Adrian Cole
1b8a7c02bf implement huffman decoding using code from twitter/hpack 2014-01-11 14:07:21 -08:00
jwilson
c6888734b4 Fix a bug where discardStream took way too long.
We were relying on the socket timeout of a single read,
but performing multiple reads each with independent
timeouts.
2014-01-11 13:37:48 -05:00
Adrian Cole
287152568a Changed HeaderEntry to be immutable and refactored to use array/bitset for table and references. 2014-01-09 13:20:17 -08:00
Adrian Cole
16ff09a9ea Lazy clone static table entries to avoid copying strings. 2014-01-07 14:51:11 -08:00
Adrian Cole
379e4ff199 feedback from #413 and a few optimizations on hpack. 2014-01-07 10:24:14 -08:00
jwilson
3eda83ab14 Platform.getMtu is unused.
This was a failed experiment.
2014-01-06 23:28:04 -05:00
Adrian Cole
5c787a0b9d Refactor SPDY code to use ByteString for headers. 2014-01-06 18:51:11 -08:00
Jesse Wilson
a9157db535 Merge pull request #411 from adriancole/efficient-iteration
Switch list iteration to index-based as it is more efficient on android.
2014-01-06 15:51:37 -08:00
Adrian Cole
bd26cf927a Switch list iteration to index-based as it is more efficient on android. 2014-01-06 12:44:01 -08:00
Adrian Cole
89219abb01 ByteString based on the one in wire 2014-01-06 12:22:29 -08:00
Adrian Cole
d7444f5fc4 portably handle prohibited headers across SPDY variants. 2014-01-05 16:53:13 -08:00
Adrian Cole
656bca2dc8 address comments from issue #400 2014-01-05 15:56:56 -08:00
jwilson
6a2062cb3f Change SpdyStream to be safe for any initialization order.
Previously we were assuming a field initializer wouldn't be
run until after the constructor. It wasn't and we were getting
NullPointerExceptions looking up the bufferPool.
2014-01-05 14:10:08 -05:00
Jesse Wilson
5c995ddb34 Merge pull request #400 from adriancole/http2-draft09
update http2 to draft 9 and hpack to draft 5
2014-01-05 08:38:29 -08:00
Jesse Wilson
87cab927b1 Merge pull request #396 from hwrdprkns/avoid_buffer_gc
Use AOSP ByteArrayPool to try and avoid buffer GC.
2014-01-05 07:38:41 -08:00
Adrian Cole
68de030b35 update http2 to draft 9 and hpack to draft 5 2014-01-04 19:33:14 -08:00
lingming.yb
7c9300be5f timeout issue 2014-01-04 15:20:58 +08:00
Taylor H. Perkins
8ad6e962e8 Use AOSP ByteArrayPool to try and avoid buffer GC.
Re-using buffers can help avoid GC and make things run more smoothly when streaming data.

squash! Use AOSP ByteArrayPool to try and avoid buffer GC.

Copy tests over and attempt at better formatting.

squash! Use AOSP ByteArrayPool to try and avoid buffer GC.

ArrayDeque is <= API level 9 :-(

squash! Use AOSP ByteArrayPool to try and avoid buffer GC.

Another attempt at formatting.

fixup! squash! Use AOSP ByteArrayPool to try and avoid buffer GC.

Indent code properly attempt.
2014-01-03 13:59:19 -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
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
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
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
Adrian Cole
f7d96b2563 update http/2 implementation to draft 6 2013-12-02 10:18:19 -08:00
Adrian Cole
39ede8fc00 backfill base test of simple http/2 headers frame 2013-11-26 11:47:56 -08:00
Jake Wharton
19a21936ff Remove useless String.format call. 2013-11-03 20:28:59 -08:00
jwilson
98c9288d8e Handle name/value header blocks with trailing bytes.
https://github.com/square/okhttp/issues/333
2013-11-03 20:58:58 -05:00
Guillaume Legrand
32a716667d Fix unresolved function call on JVM < 1.7
This notably allows the mockwebserver project to be run on Android.
ServerSocket only implements Closeable since Java 1.7 and thus calling of
closeQuietly(Closeable) with a ServerSocket argument fails when running
on Java 1.5 or 1.6 JVMs. This is the same as is already done for
closeQuietly(Socket).
2013-10-08 15:39:21 +02:00
jwilson
29ab48bf0d Fix a race condition in Connection.isExpired().
This was causing some SPDY connections to be evicted early,
and preventing connection reuse.

The spdyConnectionReuse test becomes flaky with the
fix that makes MockWebServer use different sequenceNumbers
for different requests on the same socket. With the fix
the test is no longer flaky. The old test wasn't good enough
to detect what it wanted to detect!

This race has existed in the code since we added more
aggressive time-based expiration in January 2013. In my
basic tests the race impacted ~20% of connections on a
desktop VM. It may have been more on mobile.
2013-09-29 16:08:06 -04:00
jwilson
742cee9e41 Static HTTPS/SPDY3/HTTP2 server example 2013-09-07 11:21:14 -04:00
jwilson
8dee226c7c Write some HTTP/2.0 frames 2013-09-02 12:49:56 -04:00
jwilson
a91124b6d4 Use one callback for SYN_STREAM, SYN_REPLY and HEADERS.
This is closer to the semantics of HTTP/2.0, which uses the HEADERS
frame for all three types. SPDY is a bit more strict because it
relies on redundancy; it's an error to send a SYN_REPLY after a
HEADERS frame. With HTTP/2.0, there's only one type so there's
no error to detect.
2013-09-01 13:57:20 -04:00