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

98 Commits

Author SHA1 Message Date
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
RayFromSquare
e8afabe11c Merge pull request #53 from square/jwilson/connection_selector
New route selector to support multiple routes.
2012-11-10 14:33:03 -08:00
Jesse Wilson
3355d0c99b New route selector to support multiple routes. 2012-11-10 13:05:53 -08:00
Jake Wharton
21e9c83988 Merge pull request #52 from square/jwilson/exercise
Fix some bugs from exercising HttpConnection + SPDY.
2012-11-07 14:20:59 -08:00
Jesse Wilson
e5b78cabad Fix some bugs from exercising HttpConnection + SPDY.
I was trying to reproduce a connectivity problem and
I found other related problems along the way:
 - We were unnecessarily creating new HttpConnection instances.
 - We were using "" as the file instead of "/" for SPDY.
2012-11-07 14:18:12 -08:00
Jake Wharton
e6aee71582 Merge pull request #49 from square/jwilson/connections
Make HttpConnection.connect return full working connections.
2012-11-05 21:42:42 -08:00
Jake Wharton
0ce37b70f8 Correct checkstyle errors. 2012-11-05 21:35:22 -08:00
Jesse Wilson
40ff765470 Make HttpConnection.connect return full working connections.
Previously the returned connections required the caller to
do extra work: setting up tunnels (which could require auth)
and performing an SSL handshake. With this change we make a
complete working connection in HttpConnection.connect().

This will make it easier to fix fallback when a single domain
has multiple IP addresses and some of those addresses are not
reachable.

This will also make it easier to do SPDY through HTTP proxies.
2012-11-05 20:25:52 -08:00
Jake Wharton
f1eacbff7e Merge pull request #48 from square/jwilson/recycle_gzip
Fix connection recycling for TLS+gzip+chunked.
2012-10-27 19:41:27 -07:00
Jesse Wilson
2f5e25e4dc Fix connection recycling for TLS+gzip+chunked.
We had a bug where the underlying SSLInputStream always returned
0 for InputStream.available(). This prevented us from ever reading
the "end of stream" chunk, which prevented connection recycling.
http://code.google.com/p/android/issues/detail?id=38817

Also fix a nearby bug where we were fast-forwarding the gzipped
stream when we should have been fast-forwarding the transfer
stream when we were preparing to recycle a connection.
2012-10-25 12:03:13 -04:00
Jake Wharton
4c39ccf9fe Merge pull request #47 from square/jwilson/tunnels
Fix a severe bug where multiple TLS tunnels were attempted.
2012-10-24 20:02:52 -07:00
Jesse Wilson
cbb33cbd05 Fix a severe bug where multiple TLS tunnels were attempted.
The previous code would attempt a TLS tunnel on reused
HTTPS connections, even after the tunnel had been established.
This is a severe protocol error!
2012-10-24 22:15:51 -04:00
Jake Wharton
51c7b6cad2 Write checkstyle to stdout. 2012-10-16 21:46:26 -07:00
Jake Wharton
b6e785e79e Merge pull request #46 from square/jwilson/close
Tests and code for various SPDY close scenarios.
2012-10-07 09:25:14 -07:00
Jake Wharton
df778b7b80 Switch to CONTRIBUTING file. 2012-10-05 22:43:59 -07:00
Jake Wharton
757f8ede89 Add Travis config. 2012-10-05 22:38:17 -07:00
Jesse Wilson
99fb988657 Tests and code for various SPDY close scenarios.
Writing this change has led me to believe that the
concurrency here is just plain awful, and I need to
find a better solution than what I have. In particular,
there are too many threads:
 - the internal reader thread
 - application reader threads
 - application writer threads
And too many locks:
 - the SpdyWriter I/O write lock
 - the SpdyConnection internal state lock
 - each SpdyStream's internal state lock

What's currently very wrong is the internal reader thread
is updating state in the SpdyStream, and reading bytes from
the network into a particular stream. It is an error to hold
the SpdyStream's lock while reading, but we're doing it because
we need to hold the state on the buffer, position and limit.
We need to rethink this!

Chrome doesn't run into this problem because it can 'fire and
forget' events. We can't do that because SPDY writes need to
throw IOExceptions if the writes fail.
2012-10-02 18:51:46 -04:00
Jake Wharton
e6fa46959b Merge pull request #45 from square/jwilson/readhandler
Use callbacks rather than fields to handle incoming frames.
2012-09-30 19:19:20 -07:00
Jesse Wilson
961d797e9c Use callbacks rather than fields to handle incoming frames. 2012-09-30 12:05:54 -04:00
Jake Wharton
277fa12c5e Merge pull request #44 from square/jwilson/noop
Support noop frames. Make ping sending a blocking (synchronous) call.
2012-09-29 12:59:00 -07:00
Jesse Wilson
d2fc60ad18 Support noop frames. Make ping sending a blocking (synchronous) call.
Although blocking calls don't fit the SPDY model very well, they
make exception transparency easy. In this case, a NOOP or a PING
will throw if it cannot be sent. This is good.
2012-09-29 14:25:08 -04:00
Patrick Forhan
8fe93f33dc Merge pull request #43 from square/jwilson/strictstatuscode
Be strict and careful when parsing the response status line.
2012-09-28 08:01:08 -07:00
Jesse Wilson
48b087d327 Be strict and careful when parsing the response status line.
The current status line parsing is lenient and sloppy; a
holdover from an ancient version of this library. The new
code is strict and provides a helpful message if a bogus
status line is encountered.

To make this possible the RawHeaders class needs a hint
about whether it's looking for a request line (from an
HTTP request) or a status line (from an HTTP response).
The old sloppy code used the same APIs for both.
2012-09-28 10:53:54 -04:00
Jake Wharton
315eac9792 Merge pull request #42 from square/jwilson/replyfin
Support reply with fin for no response body.
2012-09-27 09:22:24 -07:00
Jesse Wilson
747da632ad Support reply with fin for no response body. 2012-09-27 12:19:40 -04:00
edenman
c5a270e624 Merge pull request #40 from square/jwilson/period
Missed my period.
2012-09-26 11:41:15 -07:00
Jesse Wilson
1ef44259dc Missed my period. 2012-09-26 14:40:18 -04:00
Patrick Forhan
b0b1c06a06 Merge pull request #39 from square/jwilson/methods
Abandon foolish consistency with SpdyReader for sending frames.
2012-09-26 09:01:19 -07:00
Jesse Wilson
853c4012b7 Abandon foolish consistency with SpdyReader for sending frames.
Setting fields and then calling a method is just not as usable
as calling a method that takes arguments.

Also move Settings into their own class, so we can sling them
around without a bunch of ceremony.
2012-09-26 11:58:14 -04:00
Jake Wharton
6ac030e67b Merge pull request #38 from square/jwilson/streamfailure
Address some todos around stream failures and peer errors.
2012-09-25 14:36:58 -07:00
Jesse Wilson
68ebb704fb Address some todos around stream failures and peer errors. 2012-09-25 17:32:28 -04:00
Jake Wharton
0bfb878783 Merge pull request #37 from square/jwilson/concurrency
Be more careful about synchronization.
2012-09-25 12:06:17 -07:00
Jesse Wilson
60b3a6dd62 Be more careful about synchronization.
SpdyConnection needs to guard its own state separately from
the SpdyWriter, which permits slow blocking calls. Split these
into multiple independent locks.

Also use independent right-sized thread pools for reading (exactly
one thread all the time) delayed writing (0 or 1 threads) and
callbacks (any number of threads).
2012-09-25 14:29:25 -04:00
RayFromSquare
7915310262 Merge pull request #36 from square/jwilson/braces
We don't need no stinkin braces.
2012-09-25 09:04:26 -07:00
Jesse Wilson
ac0a0b98e4 We don't need no stinkin braces. 2012-09-25 12:00:39 -04:00
Jake Wharton
1853b5b108 Merge pull request #35 from square/jwilson/ping
Implement TYPE_PING.
2012-09-24 22:21:23 -07:00
Jake Wharton
9ecb2a883b Merge pull request #31 from square/jwilson/auth
Fix Authenticator callbacks to include full information.
2012-09-24 22:19:46 -07:00
Jake Wharton
c37f520b9f Merge pull request #34 from square/jwilson/substring
Fix a bug where String.substring() parameters were flipped.
2012-09-24 22:08:54 -07:00
Jesse Wilson
b3405b09cd Fix a bug where String.substring() parameters were flipped. 2012-09-25 01:07:18 -04:00
Jesse Wilson
2bd54fa72f Implement TYPE_PING.
Though it isn't particularly useful in practice, it's
going to be extremely handy for testing since it makes
a happens-before relationship very easy to create.
2012-09-25 00:34:47 -04:00
Jake Wharton
5f239296e9 Correct checkstyle. 2012-09-24 13:16:16 -07:00
Jake Wharton
37ce66117e Merge pull request #33 from square/jwilson/spdysettings
Handle incoming SETTINGS frames in SPDY.
2012-09-22 11:31:49 -07:00
Jesse Wilson
7a7ad1cdb2 Handle incoming SETTINGS frames in SPDY. 2012-09-21 17:28:07 -04:00
Jesse Wilson
5d4e9ac850 Fix Authenticator callbacks to include full information.
These were passing the wrong parameters for proxies, and not
including enough information for origin servers.

Related to: http://code.google.com/p/android/issues/detail?id=18856
2012-09-20 20:33:00 -04:00
Jake Wharton
a40fb20544 Merge pull request #30 from square/jwilson/tunnelconnect
Fix a bug in tunnel construction and 'Connection: close' headers.
2012-09-20 13:54:26 -07:00
Jesse Wilson
b8c51dc5bd Fix a bug in tunnel construction and 'Connection: close' headers.
http://code.google.com/p/android/issues/detail?id=37221
2012-09-20 16:47:52 -04:00
Jake Wharton
83d3e2ff5e Merge pull request #29 from square/jwilson/tunnel
Fix TLS requiresTunnel which was being computed incorrectly.
2012-09-20 13:04:25 -07:00
Jesse Wilson
5aa2456a14 Fix TLS requiresTunnel which was being computed incorrectly.
We were only returning 'true' once we were already in a tunnel.
This was bogus. In theory a TLS tunnel sending extra data could
be corrupted due to this bug.

Also migrate one of the TLS tunnel tests to use SslContextBuilder
instead of TestSSLContext.
2012-09-20 16:01:17 -04:00
Jesse Wilson
0db286f898 Merge pull request #28 from square/jw/checkstyle
Fix checkstyle errors.
2012-09-19 16:11:14 -07:00