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

1704 Commits

Author SHA1 Message Date
Jesse Wilson
e2f3a21849 Merge pull request #1330 from joschi/headers-map
Allow to create Headers from Map
2015-01-16 22:54:29 -05:00
Jesse Wilson
74001bbdb6 Merge pull request #1332 from jbornemann/update_http_default_cache_codes
Update http default cache codes
2015-01-16 22:52:54 -05:00
Jeff Bornemann
515ae8fef6 cache-by-default status codes now up to date 2015-01-16 17:07:47 -05:00
Jochen Schalanda
ab2dbb98dd Adapt to Square code style 2015-01-16 10:37:28 +01:00
Jochen Schalanda
dd0f2e9d1b Add method to create Headers from Map<String, String> 2015-01-15 16:08:32 +01:00
Jake Wharton
84d87a7e39 Merge pull request #1326 from nfuller/FixSocketCloseOnAndroid
Fix for MockWebServer on Android
2015-01-15 09:41:13 -05:00
Neil Fuller
0b69d29ba1 Fix for MockWebServer on Android
On Android L (and probably prior releases) it is necessary to
close a socket explicitly rather than relying on
InputStream/OutputStream to do it for you.

See bug here: https://code.google.com/p/android/issues/detail?id=97564
2015-01-15 10:37:00 +00:00
Jesse Wilson
c7803020b5 Merge pull request #1324 from nfuller/1208FollowUpFixes
Follow up fixes from pull request 1208
2015-01-14 15:24:54 -05:00
Neil Fuller
6e3fc45ebf Follow up fixes from pull request 1208
Based on comments made during the review.
2015-01-14 14:07:40 +00:00
Jake Wharton
1551f50f99 Merge pull request #1323 from square/jwilson_0113_clean_shutdown
Hurry up connection pool shutdown.
2015-01-13 18:42:14 -05:00
Jesse Wilson
e3d39f7ec0 Hurry up connection pool shutdown.
Closes https://github.com/square/okhttp/issues/1306
2015-01-13 18:33:37 -05:00
Jesse Wilson
14732f25ac Merge pull request #1317 from ajwhite/bugfix/delete-request-body
Bugfix - Optional DELETE RequestBody via Request.Builder
2015-01-13 18:17:23 -05:00
Jesse Wilson
2c3cd09a61 Merge pull request #1322 from nfuller/FixFallbackTlsExtensions
TLSv1 supports TLS extensions so they should be enabled
2015-01-13 18:15:02 -05:00
Jesse Wilson
6716888cb0 Merge pull request #1320 from nfuller/FixMockWebServerOnAndroid
Modify the way MockWebServer selects a host IP to bind to
2015-01-13 18:12:50 -05:00
Jesse Wilson
2f50252df4 Merge pull request #1312 from nfuller/PullOutAndroidSupport
Create a new maven artifact to hold things needed for Android embedding
2015-01-13 17:12:26 -05:00
Jesse Wilson
ef4e9b99d3 Merge pull request #1299 from nfuller/ConnectionRouteSelection2
Refactoring: Make RouteSelector independent of Connection
2015-01-13 17:09:54 -05:00
Jesse Wilson
bd83d72b95 Merge pull request #1208 from nfuller/CipherSuiteSocketDefaultRevert
Modify the cipher suite / TLS version selection behavior
2015-01-13 16:51:00 -05:00
Neil Fuller
285ac49b6a TLSv1 supports TLS extensions so they should be enabled
Follow up to:
https://github.com/square/okhttp/pull/1196.

Combined with an NPN bug (18705877) on Android this is the
reason why fallback connections started failing on Android
after the COMPATIBLE_TLS was changed to be TLSv1.

[The NPN bug means that once enabled on a socket from an
SSLContext then NPN must be configured for every subsequent
socket otherwise some of the NPN state will still be set,
but some will be missing, leading to negotiation issues].

The implication of this change is that the follow up request
after a handshake failure may now be HTTP/2 or SPDY
(or HTTP/1.1). Previous to this change they would always
have been HTTP/1.1.

Previous to pull 1196 they would also have been
HTTP/1.1 because COMPATIBLE_TLS was SSLv3.
2015-01-13 14:59:27 +00:00
Jake Wharton
6a959365c9 Merge pull request #1321 from nfuller/FixCallTestOnAndroid
Fix the user agent test so it works with a different user agent string
2015-01-13 09:01:43 -05:00
Jake Wharton
b9b06e13dd Merge pull request #1315 from square/jw/move-string-helpers
Move stringy test methods to test class.
2015-01-13 09:01:03 -05:00
Jake Wharton
62efd9184c Move stringy test methods to test class. 2015-01-13 08:54:02 -05:00
Neil Fuller
6a5a61a47a Fix the user agent test so it works with a different user agent string
The important thing is that the Version.userAgent() string is used and
not the exact string.
2015-01-13 13:48:26 +00:00
Neil Fuller
9877d1b4da Modify the way MockWebServer selects a host IP to bind to
On Android getByName(null) returns the first of
[IPv6 loopback, IPv4 loopback], binding the server to ::1.
The IPv6 loopback address returns "localhost". "localhost"
does not resolve to the IPv6 address.

Instead: explicitly select "localhost" ensuring
MockWebServer binds to an IP that can be looked up by name
and should also be a loopback address.
2015-01-13 13:44:20 +00:00
Jesse Wilson
7282664d97 Merge pull request #1316 from square/jw/skip
Empty sinks must still honor the contract by consuming the bytes.
2015-01-13 08:14:59 -05:00
Atticus White
e97bb77a0e adds optional request body for DELETE requests to ammend #610 2015-01-12 19:50:18 -05:00
Jake Wharton
f7de645ded Empty sinks must still honor the contract by consuming the bytes. 2015-01-12 18:25:33 -05:00
Jake Wharton
6910936dd3 Merge pull request #1313 from nfuller/FixDiskLruCacheAfterInit
Fix isClosed() when a cache has not been initialized
2015-01-12 06:25:24 -08:00
Neil Fuller
99f2bafe1c Fix isClosed() when a cache has not been initialized
isClosed() now means "has close() been called", after
commit ea565b2e30
it meant "has not been initialized or close() has been
called".

Introduced explicit closed state. Minor tweak to use
initialized state to determine whether cleanup will
do anything. Added a test.
2015-01-12 13:22:09 +00:00
Neil Fuller
c9b0262c40 Create a new maven artifact to hold things needed for Android embedding
okhttp-android-support contains classes needed for Android embedding and
not for normal OkHttp development. The classes here can be excluded from
okhttp-urlconnection, shrinking that artifact. More classes will be
added to this component to make Android maintenance easier.
2015-01-12 10:55:17 +00:00
Jake Wharton
78c493e337 Merge pull request #1310 from square/jw/lazy-cache
Lazily initialize the cache.
2015-01-11 13:32:58 -08:00
Jake Wharton
ea565b2e30 Lazily initialize the cache. 2015-01-11 13:28:13 -08:00
Jesse Wilson
510af4e491 Merge pull request #1307 from nfuller/IoExceptionOnResponseBody3
Source-incompatible: ResponseBody methods throw IOException
2015-01-09 11:04:52 -05:00
Neil Fuller
6ca86d4de1 Source-incompatible: ResponseBody methods throw IOException
This is a binary-compatible change, but code that currently calls
ResponseBody [contentLength()|byteStream()|source()|charStream()]
that doesn't necessarily catch or declare IOException will need
to with this change.

These methods could be performing I/O (opening streams, etc.).
Throwing IOException seems reasonable in this case.

contentType() and charset() have not been changed.
2015-01-09 15:32:24 +00:00
Jesse Wilson
933da4a430 Merge pull request #1297 from square/jw/mock-headers
Use 'Headers' in recorded response.
2015-01-07 19:32:35 -05:00
Neil Fuller
f695ea7f23 Modify the cipher suite / TLS version selection behavior
Motivation 1: Cipher selection and TLS protocol version selection
should be performed over "enabled", not "support" values. Otherwise,
ciphers / protocols that are disabled by default are re-enabled.
Android would like to avoid enabling values that are considered unsafe
and are disabled by the platform, apps or GMS core.

Motivation 2: Opinionated cipher suite selection makes sense for
OkHttp when bundled with apps. OkHttp probably has the best/newest
information available when compared with the socket factory it
encounters.

However, with the Android platform usecase the socket factory (i.e.
one from the platform, from GMS core, or installed by the app) might
have better information (or reasons why specific suites should not be
used and so it modifies the "enabled" set). Android would therefore
prefer OkHttp to select from a default set specified by the socket
factory, not a list hard-coded at release time.

Unlike ciphers, for protocols there is no current need to
go with the default enabled set so supporting "null" / "use default"
is not required for protocols.

Other change:

The ConnectionSpec caching (see supportedSpec) has been removed from
ConnectionSpec. This seems like an risky optimization to me in an
environment where different SocketFactory instances could be encountered
and doing it properly seems costly and of limited benefit.
2015-01-07 14:33:09 +00:00
Jesse Wilson
6f1af29142 Merge pull request #1298 from square/jw/no-one-used-this
Remove old SSL protocol method.
2015-01-06 14:52:15 -05:00
Neil Fuller
52454c6199 Refactoring: Make RouteSelector independent of Connection
Ultimate goal: to improve the TLS fallback behavior so that
socket connections will not be created if the necessary
TLS protocols will not be supported.

To achieve this RouteSelector will be moved into Connection
and so that it can be passed the Socket or protocol information
during the route selection process.

This is a small first step: Make RouteSelector independent
of Connection so that it can later be moved inside of
Connection. It puts the RouteSelector interface in terms
of Routes, which seems logical.
2015-01-06 12:03:17 +00:00
Jake Wharton
4ab6a8258b Remove old SSL protocol method. 2015-01-05 22:41:54 -08:00
Jake Wharton
c46b61d565 Use 'Headers' in recorded response. 2015-01-05 22:38:23 -08:00
Jake Wharton
5f44ca768e Merge pull request #1289 from square/jw/time-unit
Clean up time-based APIs for throttle and delay.
2015-01-05 10:09:22 -08:00
Jake Wharton
8f54a48ea5 Clean up time-based APIs for throttle and delay. 2015-01-05 09:34:33 -08:00
Jesse Wilson
f84c2c022a Merge pull request #1290 from square/jw/start
Rename play to start.
2015-01-05 10:32:51 -05:00
Jesse Wilson
a5e13bd335 Merge pull request #1292 from square/jw/more-long
Time amounts should be longs.
2015-01-05 10:31:57 -05:00
Jesse Wilson
58dff54d1e Merge pull request #1293 from square/jw/zero
Take no action if transferring zero bytes.
2015-01-05 10:31:32 -05:00
Jesse Wilson
4ae1b23953 Merge pull request #1291 from square/jw/long-limit
Body limit should be long.
2015-01-05 10:30:40 -05:00
Jesse Wilson
0dadd042c1 Merge pull request #1295 from square/jw/mock-response-headers
Expose Headers directly on MockResponse.
2015-01-05 10:30:06 -05:00
Jake Wharton
c5c4e7857c Expose Headers directly on MockResponse. 2015-01-05 00:42:01 -08:00
Jake Wharton
6763803c3d Merge pull request #1270 from square/jw/mock-web-headers
Update MockWebServer to use Headers.
2015-01-05 00:27:30 -08:00
Jake Wharton
8e201297fe Update MockWebServer to use Headers. 2015-01-05 00:18:56 -08:00
Jake Wharton
5355762a6f Rename play to start. 2015-01-04 23:17:42 -08:00