1Change Log 2========== 3 4## Version 2.5.0 5 6_2015-08-25_ 7 8 * **Timeouts now default to 10 seconds.** Previously we defaulted to never 9 timing out, and that was a lousy policy. If establishing a connection, 10 reading the next byte from a connection, or writing the next byte to a 11 connection takes more than 10 seconds to complete, you’ll need to adjust 12 the timeouts manually. 13 14 * **OkHttp now rejects request headers that contain invalid characters.** This 15 includes potential security problems (newline characters) as well as simple 16 non-ASCII characters (including international characters and emoji). 17 18 * **Call canceling is more reliable.** We had a bug where a socket being 19 connected wasn't being closed when the application used `Call.cancel()`. 20 21 * **Changing a HttpUrl’s scheme now tracks the default port.** We had a bug 22 where changing a URL from `http` to `https` would leave it on port 80. 23 24 * **Okio has been updated to 1.6.0.** 25 ``` 26 <dependency> 27 <groupId>com.squareup.okio</groupId> 28 <artifactId>okio</artifactId> 29 <version>1.6.0</version> 30 </dependency> 31 ``` 32 33 * New: `Cache.initialize()`. Call this on a background thread to eagerly 34 initialize the response cache. 35 * New: Fold `MockWebServerRule` into `MockWebServer`. This makes it easier to 36 write JUnit tests with `MockWebServer`. The `MockWebServer` library now 37 depends on JUnit, though it continues to work with all testing frameworks. 38 * Fix: `FormEncodingBuilder` is now consistent with browsers in which 39 characters it escapes. Previously we weren’t percent-encoding commas, 40 parens, and other characters. 41 * Fix: Relax `FormEncodingBuilder` to support building empty forms. 42 * Fix: Timeouts throw `SocketTimeoutException`, not `InterruptedIOException`. 43 * Fix: Change `MockWebServer` to use the same logic as OkHttp when determining 44 whether an HTTP request permits a body. 45 * Fix: `HttpUrl` now uses the canonical form for IPv6 addresses. 46 * Fix: Use `HttpUrl` internally. 47 * Fix: Recover from Android 4.2.2 EBADF crashes. 48 * Fix: Don't crash with an `IllegalStateException` if an HTTP/2 or SPDY 49 write fails, leaving the connection in an inconsistent state. 50 * Fix: Make sure the default user agent is ASCII. 51 52 53## Version 2.4.0 54 55_2015-05-22_ 56 57 * **Forbid response bodies on HTTP 204 and 205 responses.** Webservers that 58 return such malformed responses will now trigger a `ProtocolException` in 59 the client. 60 61 * **WebSocketListener has incompatible changes.** The `onOpen()` method is now 62 called on the reader thread, so implementations must return before further 63 websocket messages will be delivered. The `onFailure()` method now includes 64 an HTTP response if one was returned. 65 66## Version 2.4.0-RC1 67 68_2015-05-16_ 69 70 * **New HttpUrl API.** It's like `java.net.URL` but good. Note that 71 `Request.Builder.url()` now throws `IllegalArgumentException` on malformed 72 URLs. (Previous releases would throw a `MalformedURLException` when calling 73 a malformed URL.) 74 75 * **We've improved connect failure recovery.** We now differentiate between 76 setup, connecting, and connected and implement appropriate recovery rules 77 for each. This changes `Address` to no longer use `ConnectionSpec`. (This is 78 an incompatible API change). 79 80 * **`FormEncodingBuilder` now uses `%20` instead of `+` for encoded spaces.** 81 Both are permitted-by-spec, but `%20` requires fewer special cases. 82 83 * **Okio has been updated to 1.4.0.** 84 ``` 85 <dependency> 86 <groupId>com.squareup.okio</groupId> 87 <artifactId>okio</artifactId> 88 <version>1.4.0</version> 89 </dependency> 90 ``` 91 92 * **`Request.Builder` no longer accepts null if a request body is required.** 93 Passing null will now fail for request methods that require a body. Instead 94 use an empty body such as this one: 95 96 ``` 97 RequestBody.create(null, new byte[0]); 98 ``` 99 100 * **`CertificatePinner` now supports wildcard hostnames.** As always with 101 certificate pinning, you must be very careful to avoid [bricking][brick] 102 your app. You'll need to pin both the top-level domain and the `*.` domain 103 for full coverage. 104 105 ``` 106 client.setCertificatePinner(new CertificatePinner.Builder() 107 .add("publicobject.com", "sha1/DmxUShsZuNiqPQsX2Oi9uv2sCnw=") 108 .add("*.publicobject.com", "sha1/DmxUShsZuNiqPQsX2Oi9uv2sCnw=") 109 .add("publicobject.com", "sha1/SXxoaOSEzPC6BgGmxAt/EAcsajw=") 110 .add("*.publicobject.com", "sha1/SXxoaOSEzPC6BgGmxAt/EAcsajw=") 111 .add("publicobject.com", "sha1/blhOM3W9V/bVQhsWAcLYwPU6n24=") 112 .add("*.publicobject.com", "sha1/blhOM3W9V/bVQhsWAcLYwPU6n24=") 113 .add("publicobject.com", "sha1/T5x9IXmcrQ7YuQxXnxoCmeeQ84c=") 114 .add("*.publicobject.com", "sha1/T5x9IXmcrQ7YuQxXnxoCmeeQ84c=") 115 .build()); 116 ``` 117 118 * **Interceptors lists are now deep-copied by `OkHttpClient.clone()`.** 119 Previously clones shared interceptors, which made it difficult to customize 120 the interceptors on a request-by-request basis. 121 122 * New: `Headers.toMultimap()`. 123 * New: `RequestBody.create(MediaType, ByteString)`. 124 * New: `ConnectionSpec.isCompatible(SSLSocket)`. 125 * New: `Dispatcher.getQueuedCallCount()` and 126 `Dispatcher.getRunningCallCount()`. These can be useful in diagnostics. 127 * Fix: OkHttp no longer shares timeouts between pooled connections. This was 128 causing some applications to crash when connections were reused. 129 * Fix: `OkApacheClient` now allows an empty `PUT` and `POST`. 130 * Fix: Websockets no longer rebuffer socket streams. 131 * Fix: Websockets are now better at handling close frames. 132 * Fix: Content type matching is now case insensitive. 133 * Fix: `Vary` headers are not lost with `android.net.http.HttpResponseCache`. 134 * Fix: HTTP/2 wasn't enforcing stream timeouts when writing the underlying 135 connection. Now it is. 136 * Fix: Never return null on `call.proceed()`. This was a bug in call 137 cancelation. 138 * Fix: When a network interceptor mutates a request, that change is now 139 reflected in `Response.networkResponse()`. 140 * Fix: Badly-behaving caches now throw a checked exception instead of a 141 `NullPointerException`. 142 * Fix: Better handling of uncaught exceptions in MockWebServer with HTTP/2. 143 144## Version 2.3.0 145 146_2015-03-16_ 147 148 * **HTTP/2 support.** We've done interop testing and haven't seen any 149 problems. HTTP/2 support has been a big effort and we're particularly 150 thankful to Adrian Cole who has helped us to reach this milestone. 151 152 * **RC4 cipher suites are no longer supported by default.** To connect to 153 old, obsolete servers relying on these cipher suites, you must create a 154 custom `ConnectionSpec`. 155 156 * **Beta WebSockets support.**. The `okhttp-ws` subproject offers a new 157 websockets client. Please try it out! When it's ready we intend to include 158 it with the core OkHttp library. 159 160 * **Okio updated to 1.3.0.** 161 162 ``` 163 <dependency> 164 <groupId>com.squareup.okio</groupId> 165 <artifactId>okio</artifactId> 166 <version>1.3.0</version> 167 </dependency> 168 ``` 169 170 * **Fix: improve parallelism of async requests.** OkHttp's Dispatcher had a 171 misconfigured `ExecutorService` that limited the number of worker threads. 172 If you're using `Call.enqueue()` this update should significantly improve 173 request concurrency. 174 175 * **Fix: Lazily initialize the response cache.** This avoids strict mode 176 warnings when initializing OkHttp on Android‘s main thread. 177 178 * **Fix: Disable ALPN on Android 4.4.** That release of the feature was 179 unstable and prone to native crashes in the underlying OpenSSL code. 180 * Fix: Don't send both `If-None-Match` and `If-Modified-Since` cache headers 181 when both are applicable. 182 * Fix: Fail early when a port is out of range. 183 * Fix: Offer `Content-Length` headers for multipart request bodies. 184 * Fix: Throw `UnknownServiceException` if a cleartext connection is attempted 185 when explicitly forbidden. 186 * Fix: Throw a `SSLPeerUnverifiedException` when host verification fails. 187 * Fix: MockWebServer explicitly closes sockets. (On some Android releases, 188 closing the input stream and output stream of a socket is not sufficient. 189 * Fix: Buffer outgoing HTTP/2 frames to limit how many outgoing frames are 190 created. 191 * Fix: Avoid crashing when cache writing fails due to a full disk. 192 * Fix: Improve caching of private responses. 193 * Fix: Update cache-by-default response codes. 194 * Fix: Reused `Request.Builder` instances no longer hold stale URL fields. 195 * New: ConnectionSpec can now be configured to use the SSL socket's default 196 cipher suites. To use, set the cipher suites to `null`. 197 * New: Support `DELETE` with a request body. 198 * New: `Headers.of(Map)` creates headers from a Map. 199 200 201## Version 2.2.0 202 203_2014-12-30_ 204 205 * **`RequestBody.contentLength()` now throws `IOException`.** 206 This is a source-incompatible change. If you have code that calls 207 `RequestBody.contentLength()`, your compile will break with this 208 update. The change is binary-compatible, however: code compiled 209 for OkHttp 2.0 and 2.1 will continue to work with this update. 210 211 * **`COMPATIBLE_TLS` no longer supports SSLv3.** In response to the 212 [POODLE](http://googleonlinesecurity.blogspot.ca/2014/10/this-poodle-bites-exploiting-ssl-30.html) 213 vulnerability, OkHttp no longer offers SSLv3 when negotiation an 214 HTTPS connection. If you continue to need to connect to webservers 215 running SSLv3, you must manually configure your own `ConnectionSpec`. 216 217 * **OkHttp now offers interceptors.** Interceptors are a powerful mechanism 218 that can monitor, rewrite, and retry calls. The [project 219 wiki](https://github.com/square/okhttp/wiki/Interceptors) has a full 220 introduction to this new API. 221 222 * New: APIs to iterate and selectively clear the response cache. 223 * New: Support for SOCKS proxies. 224 * New: Support for `TLS_FALLBACK_SCSV`. 225 * New: Update HTTP/2 support to to `h2-16` and `hpack-10`. 226 * New: APIs to prevent retrying non-idempotent requests. 227 * Fix: Drop NPN support. Going forward we support ALPN only. 228 * Fix: The hostname verifier is now strict. This is consistent with the hostname 229 verifier in modern browsers. 230 * Fix: Improve `CONNECT` handling for misbehaving HTTP proxies. 231 * Fix: Don't retry requests that failed due to timeouts. 232 * Fix: Cache 302s and 308s that include appropriate response headers. 233 * Fix: Improve pooling of connections that use proxy selectors. 234 * Fix: Don't leak connections when using ALPN on the desktop. 235 * Fix: Update Jetty ALPN to `7.1.2.v20141202` (Java 7) and `8.1.2.v20141202` (Java 8). 236 This fixes a bug in resumed TLS sessions where the wrong protocol could be 237 selected. 238 * Fix: Don't crash in SPDY and HTTP/2 when disconnecting before connecting. 239 * Fix: Avoid a reverse DNS-lookup for a numeric proxy address 240 * Fix: Resurrect http/2 frame logging. 241 * Fix: Limit to 20 authorization attempts. 242 243## Version 2.1.0 244 245_2014-11-11_ 246 247 * New: Typesafe APIs for interacting with cipher suites and TLS versions. 248 * Fix: Don't crash when mixing authorization challenges with upload retries. 249 250 251## Version 2.1.0-RC1 252 253_2014-11-04_ 254 255 * **OkHttp now caches private responses**. We've changed from a shared cache 256 to a private cache, and will now store responses that use an `Authorization` 257 header. This means OkHttp's cache shouldn't be used on middleboxes that sit 258 between user agents and the origin server. 259 260 * **TLS configuration updated.** OkHttp now explicitly enables TLSv1.2, 261 TLSv1.1 and TLSv1.0 where they are supported. It will continue to perform 262 only one fallback, to SSLv3. Applications can now configure this with the 263 `ConnectionSpec` class. 264 265 To disable TLS fallback: 266 267 ``` 268 client.setConnectionSpecs(Arrays.asList( 269 ConnectionSpec.MODERN_TLS, ConnectionSpec.CLEARTEXT)); 270 ``` 271 272 To disable cleartext connections, permitting `https` URLs only: 273 274 ``` 275 client.setConnectionSpecs(Arrays.asList( 276 ConnectionSpec.MODERN_TLS, ConnectionSpec.COMPATIBLE_TLS)); 277 ``` 278 279 * **New cipher suites.** Please confirm that your webservers are reachable 280 with this limited set of cipher suites. 281 282 ``` 283 Android 284 Name Version 285 286 TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 5.0 287 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 5.0 288 TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 5.0 289 TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA 4.0 290 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA 4.0 291 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA 4.0 292 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA 4.0 293 TLS_ECDHE_ECDSA_WITH_RC4_128_SHA 4.0 294 TLS_ECDHE_RSA_WITH_RC4_128_SHA 4.0 295 TLS_DHE_RSA_WITH_AES_128_CBC_SHA 2.3 296 TLS_DHE_DSS_WITH_AES_128_CBC_SHA 2.3 297 TLS_DHE_RSA_WITH_AES_256_CBC_SHA 2.3 298 TLS_RSA_WITH_AES_128_GCM_SHA256 5.0 299 TLS_RSA_WITH_AES_128_CBC_SHA 2.3 300 TLS_RSA_WITH_AES_256_CBC_SHA 2.3 301 SSL_RSA_WITH_3DES_EDE_CBC_SHA 2.3 (Deprecated in 5.0) 302 SSL_RSA_WITH_RC4_128_SHA 2.3 303 SSL_RSA_WITH_RC4_128_MD5 2.3 (Deprecated in 5.0) 304 ``` 305 306 * **Okio updated to 1.0.1.** 307 308 ``` 309 <dependency> 310 <groupId>com.squareup.okio</groupId> 311 <artifactId>okio</artifactId> 312 <version>1.0.1</version> 313 </dependency> 314 ``` 315 316 * **New APIs to permit easy certificate pinning.** Be warned, certificate 317 pinning is dangerous and could prevent your application from trusting your 318 server! 319 320 * **Cache improvements.** This release fixes some severe cache problems 321 including a bug where the cache could be corrupted upon certain access 322 patterns. We also fixed a bug where the cache was being cleared due to a 323 corrupted journal. We've added APIs to configure a request's `Cache-Control` 324 headers, and to manually clear the cache. 325 326 * **Request cancellation fixes.** This update fixes a bug where synchronous 327 requests couldn't be canceled by tag. This update avoids crashing when 328 `onResponse()` throws an `IOException`. That failure will now be logged 329 instead of notifying the thread's uncaught exception handler. We've added a 330 new API, `Call.isCanceled()` to check if a call has been canceled. 331 332 * New: Update `MultipartBuilder` to support content length. 333 * New: Make it possible to mock `OkHttpClient` and `Call`. 334 * New: Update to h2-14 and hpack-9. 335 * New: OkHttp includes a user-agent by default, like `okhttp/2.1.0-RC1`. 336 * Fix: Handle response code `308 Permanent Redirect`. 337 * Fix: Don't skip the callback if a call is canceled. 338 * Fix: Permit hostnames with underscores. 339 * Fix: Permit overriding the content-type in `OkApacheClient`. 340 * Fix: Use the socket factory for direct connections. 341 * Fix: Honor `OkUrlFactory` APIs that disable redirects. 342 * Fix: Don't crash on concurrent modification of `SPDY` SPDY settings. 343 344## Version 2.0.0 345 346This release commits to a stable 2.0 API. Read the 2.0.0-RC1 changes for advice 347on upgrading from 1.x to 2.x. 348 349_2014-06-21_ 350 351 * **API Change**: Use `IOException` in `Callback.onFailure()`. This is 352 a source-incompatible change, and is different from OkHttp 2.0.0-RC2 which 353 used `Throwable`. 354 * Fix: Fixed a caching bug where we weren't storing rewritten request headers 355 like `Accept-Encoding`. 356 * Fix: Fixed bugs in handling the SPDY window size. This was stalling certain 357 large downloads 358 * Update the language level to Java 7. (OkHttp requires Android 2.3+ or Java 7+.) 359 360## Version 2.0.0-RC2 361 362_2014-06-11_ 363 364This update fixes problems in 2.0.0-RC1. Read the 2.0.0-RC1 changes for 365advice on upgrading from 1.x to 2.x. 366 367 * Fix: Don't leak connections! There was a regression in 2.0.0-RC1 where 368 connections were neither closed nor pooled. 369 * Fix: Revert builder-style return types from OkHttpClient's timeout methods 370 for binary compatibility with OkHttp 1.x. 371 * Fix: Don't skip client stream 1 on SPDY/3.1. This fixes SPDY connectivity to 372 `https://google.com`, which doesn't follow the SPDY/3.1 spec! 373 * Fix: Always configure NPN headers. This fixes connectivity to 374 `https://facebook.com` when SPDY and HTTP/2 are both disabled. Otherwise an 375 unexpected NPN response is received and OkHttp crashes. 376 * Fix: Write continuation frames when HPACK data is larger than 16383 bytes. 377 * Fix: Don't drop uncaught exceptions thrown in async calls. 378 * Fix: Throw an exception eagerly when a request body is not legal. Previously 379 we ignored the problem at request-building time, only to crash later with a 380 `NullPointerException`. 381 * Fix: Include a backwards-compatible `OkHttp-Response-Source` header with 382 `OkUrlFactory `responses. 383 * Fix: Don't include a default User-Agent header in requests made with the Call 384 API. Requests made with OkUrlFactory will continue to have a default user 385 agent. 386 * New: Guava-like API to create headers: 387 388 ``` 389 Headers headers = Headers.of(name1, value1, name2, value2, ...). 390 ``` 391 392 * New: Make the content-type header optional for request bodies. 393 * New: `Response.isSuccessful()` is a convenient API to check response codes. 394 * New: The response body can now be read outside of the callback. Response 395 bodies must always be closed, otherwise they will leak connections! 396 * New: APIs to create multipart request bodies (`MultipartBuilder`) and form 397 encoding bodies (`FormEncodingBuilder`). 398 399## Version 2.0.0-RC1 400 401_2014-05-23_ 402 403OkHttp 2 is designed around a new API that is true to HTTP, with classes for 404requests, responses, headers, and calls. It uses modern Java patterns like 405immutability and chained builders. The API now offers asynchronous callbacks 406in addition to synchronous blocking calls. 407 408#### API Changes 409 410 * **New Request and Response types,** each with their own builder. There's also 411 a `RequestBody` class to write the request body to the network and a 412 `ResponseBody` to read the response body from the network. The standalone 413 `Headers` class offers full access to the HTTP headers. 414 415 * **Okio dependency added.** OkHttp now depends on 416 [Okio](https://github.com/square/okio), an I/O library that makes it easier 417 to access, store and process data. Using this library internally makes OkHttp 418 faster while consuming less memory. You can write a `RequestBody` as an Okio 419 `BufferedSink` and a `ResponseBody` as an Okio `BufferedSource`. Standard 420 `InputStream` and `OutputStream` access is also available. 421 422 * **New Call and Callback types** execute requests and receive their 423 responses. Both types of calls can be canceled via the `Call` or the 424 `OkHttpClient`. 425 426 * **URLConnection support has moved to the okhttp-urlconnection module.** 427 If you're upgrading from 1.x, this change will impact you. You will need to 428 add the `okhttp-urlconnection` module to your project and use the 429 `OkUrlFactory` to create new instances of `HttpURLConnection`: 430 431 ``` 432 // OkHttp 1.x: 433 HttpURLConnection connection = client.open(url); 434 435 // OkHttp 2.x: 436 HttpURLConnection connection = new OkUrlFactory(client).open(url); 437 ``` 438 439 * **Custom caches are no longer supported.** In OkHttp 1.x it was possible to 440 define your own response cache with the `java.net.ResponseCache` and OkHttp's 441 `OkResponseCache` interfaces. Both of these APIs have been dropped. In 442 OkHttp 2 the built-in disk cache is the only supported response cache. 443 444 * **HttpResponseCache has been renamed to Cache.** Install it with 445 `OkHttpClient.setCache(...)` instead of `OkHttpClient.setResponseCache(...)`. 446 447 * **OkAuthenticator has been replaced with Authenticator.** This new 448 authenticator has access to the full incoming response and can respond with 449 whichever followup request is appropriate. The `Challenge` class is now a 450 top-level class and `Credential` is replaced with a utility class called 451 `Credentials`. 452 453 * **OkHttpClient.getFollowProtocolRedirects() renamed to 454 getFollowSslRedirects()**. We reserve the word _protocol_ for the HTTP 455 version being used (HTTP/1.1, HTTP/2). The old name of this method was 456 misleading; it was always used to configure redirects between `https://` and 457 `http://` schemes. 458 459 * **RouteDatabase is no longer public API.** OkHttp continues to track which 460 routes have failed but this is no exposed in the API. 461 462 * **ResponseSource is gone.** This enum exposed whether a response came from 463 the cache, network, or both. OkHttp 2 offers more detail with raw access to 464 the cache and network responses in the new `Response` class. 465 466 * **TunnelRequest is gone.** It specified how to connect to an HTTP proxy. 467 OkHttp 2 uses the new `Request` class for this. 468 469 * **Dispatcher** is a new class that manages the queue of asynchronous calls. It 470 implements limits on total in-flight calls and in-flight calls per host. 471 472#### Implementation changes 473 474 * Support Android `TrafficStats` socket tagging. 475 * Drop authentication headers on redirect. 476 * Added support for compressed data frames. 477 * Process push promise callbacks in order. 478 * Update to http/2 draft 12. 479 * Update to HPACK draft 07. 480 * Add ALPN support. Maven will use ALPN on OpenJDK 8. 481 * Update NPN dependency to target `jdk7u60-b13` and `Oracle jdk7u55-b13`. 482 * Ensure SPDY variants support zero-length DELETE and POST. 483 * Prevent leaking a cache item's InputStreams when metadata read fails. 484 * Use a string to identify TLS versions in routes. 485 * Add frame logger for HTTP/2. 486 * Replacing `httpMinorVersion` with `Protocol`. Expose HTTP/1.0 as a potential protocol. 487 * Use `Protocol` to describe framing. 488 * Implement write timeouts for HTTP/1.1 streams. 489 * Avoid use of SPDY stream ID 1, as that's typically used for UPGRADE. 490 * Support OAuth in `Authenticator`. 491 * Permit a dangling semicolon in media type parsing. 492 493## Version 1.6.0 494 495_2014-05-23_ 496 497 * Offer bridges to make it easier to migrate from OkHttp 1.x to OkHttp 2.0. 498 This adds `OkUrlFactory`, `Cache`, and `@Deprecated` annotations for APIs 499 dropped in 2.0. 500 501## Version 1.5.4 502 503_2014-04-14_ 504 505 * Drop ALPN support in Android. There's a concurrency bug in all 506 currently-shipping versions. 507 * Support asynchronous disconnects by breaking the socket only. This should 508 prevent flakiness from multiple threads concurrently accessing a stream. 509 510## Version 1.5.3 511 512_2014-03-29_ 513 514 * Fix bug where the Content-Length header was not always dropped when 515 following a redirect from a POST to a GET. 516 * Implement basic support for `Thread.interrupt()`. OkHttp now checks 517 for an interruption before doing a blocking call. If it is interrupted, 518 it throws an `InterruptedIOException`. 519 520## Version 1.5.2 521 522_2014-03-17_ 523 524 * Fix bug where deleting a file that was absent from the `HttpResponseCache` 525 caused an IOException. 526 * Fix bug in HTTP/2 where our HPACK decoder wasn't emitting entries in 527 certain eviction scenarios, leading to dropped response headers. 528 529## Version 1.5.1 530 531_2014-03-11_ 532 533 * Fix 1.5.0 regression where connections should not have been recycled. 534 * Fix 1.5.0 regression where transparent Gzip was broken by attempting to 535 recover from another I/O failure. 536 * Fix problems where spdy/3.1 headers may not have been compressed properly. 537 * Fix problems with spdy/3.1 and http/2 where the wrong window size was being 538 used. 539 * Fix 1.5.0 regression where conditional cache responses could corrupt the 540 connection pool. 541 542 543## Version 1.5.0 544 545_2014-03-07_ 546 547 548##### OkHttp no longer uses the default SSL context. 549 550Applications that want to use the global SSL context with OkHttp should configure their 551OkHttpClient instances with the following: 552 553```java 554okHttpClient.setSslSocketFactory(HttpsURLConnection.getDefaultSSLSocketFactory()); 555``` 556 557A simpler solution is to avoid the shared default SSL socket factory. Instead, if you 558need to customize SSL, do so for your specific OkHttpClient instance only. 559 560##### Synthetic headers have changed 561 562Previously OkHttp added a synthetic response header, `OkHttp-Selected-Transport`. It 563has been replaced with a new synthetic header, `OkHttp-Selected-Protocol`. 564 565##### Changes 566 567 * New: Support for `HTTP-draft-09/2.0`. 568 * New: Support for `spdy/3.1`. Dropped support for `spdy/3`. 569 * New: Use ALPN on Android platforms that support it (4.4+) 570 * New: CacheControl model and parser. 571 * New: Protocol selection in MockWebServer. 572 * Fix: Route selection shouldn't use TLS modes that we know will fail. 573 * Fix: Cache SPDY responses even if the response body is closed prematurely. 574 * Fix: Use strict timeouts when aborting a download. 575 * Fix: Support Shoutcast HTTP responses like `ICY 200 OK`. 576 * Fix: Don't unzip if there isn't a response body. 577 * Fix: Don't leak gzip streams on redirects. 578 * Fix: Don't do DNS lookups on invalid hosts. 579 * Fix: Exhaust the underlying stream when reading gzip streams. 580 * Fix: Support the `PATCH` method. 581 * Fix: Support request bodies on `DELETE` method. 582 * Fix: Drop the `okhttp-protocols` module. 583 * Internal: Replaced internal byte array buffers with pooled buffers ("OkBuffer"). 584 585 586## Version 1.3.0 587 588_2014-01-11_ 589 590 * New: Support for "PATCH" HTTP method in client and MockWebServer. 591 * Fix: Drop `Content-Length` header when redirected from POST to GET. 592 * Fix: Correctly read cached header entries with malformed header names. 593 * Fix: Do not directly support any authentication schemes other than "Basic". 594 * Fix: Respect read timeouts on recycled connections. 595 * Fix: Transmit multiple cookie values as a single header with delimiter. 596 * Fix: Ensure `null` is never returned from a connection's `getHeaderFields()`. 597 * Fix: Persist proper `Content-Encoding` header to cache for GZip responses. 598 * Fix: Eliminate rare race condition in SPDY streams that would prevent connection reuse. 599 * Fix: Change HTTP date formats to UTC to conform to RFC2616 section 3.3. 600 * Fix: Support SPDY header blocks with trailing bytes. 601 * Fix: Allow `;` as separator for `Cache-Control` header. 602 * Fix: Correct bug where HTTPS POST requests were always automatically buffered. 603 * Fix: Honor read timeout when parsing SPDY headers. 604 605 606## Version 1.2.1 607 608_2013-08-23_ 609 610 * Resolve issue with 'jar-with-dependencies' artifact creation. 611 * Fix: Support empty SPDY header values. 612 613 614## Version 1.2.0 615 616_2013-08-11_ 617 618 * New APIs on OkHttpClient to set default timeouts for connect and read. 619 * Fix bug when caching SPDY responses. 620 * Fix a bug with SPDY plus half-closed streams. (thanks kwuollett) 621 * Fix a bug in `Content-Length` reporting for gzipped streams in the Apache 622 HTTP client adapter. (thanks kwuollett) 623 * Work around the Alcatel `getByInetAddress` bug (thanks k.kocel) 624 * Be more aggressive about testing pooled sockets before reuse. (thanks 625 warpspin) 626 * Include `Content-Type` and `Content-Encoding` in the Apache HTTP client 627 adapter. (thanks kwuollett) 628 * Add a media type class to OkHttp. 629 * Change custom header prefix: 630 631 ``` 632 X-Android-Sent-Millis is now OkHttp-Sent-Millis 633 X-Android-Received-Millis is now OkHttp-Received-Millis 634 X-Android-Response-Source is now OkHttp-Response-Source 635 X-Android-Selected-Transport is now OkHttp-Selected-Transport 636 ``` 637 * Improve cache invalidation for POST-like requests. 638 * Bring MockWebServer into OkHttp and teach it SPDY. 639 640 641## Version 1.1.1 642 643_2013-06-23_ 644 645 * Fix: ClassCastException when caching responses that were redirected from 646 HTTP to HTTPS. 647 648 649## Version 1.1.0 650 651_2013-06-15_ 652 653 * Fix: Connection reuse was broken for most HTTPS connections due to a bug in 654 the way the hostname verifier was selected. 655 * Fix: Locking bug in SpdyConnection. 656 * Fix: Ignore null header values (for compatibility with HttpURLConnection). 657 * Add URLStreamHandlerFactory support so that `URL.openConnection()` uses 658 OkHttp. 659 * Expose the transport ("http/1.1", "spdy/3", etc.) via magic request headers. 660 Use `X-Android-Transports` to write the preferred transports and 661 `X-Android-Selected-Transport` to read the negotiated transport. 662 663 664## Version 1.0.2 665 666_2013-05-11_ 667 668 * Fix: Remove use of Java 6-only APIs. 669 * Fix: Properly handle exceptions from `NetworkInterface` when querying MTU. 670 * Fix: Ensure MTU has a reasonable default and upper-bound. 671 672 673## Version 1.0.1 674 675_2013-05-06_ 676 677 * Correct casing of SSL in method names (`getSslSocketFactory`/`setSslSocketFactory`). 678 679 680## Version 1.0.0 681 682_2013-05-06_ 683 684Initial release. 685 686 [brick]: (https://noncombatant.org/2015/05/01/about-http-public-key-pinning/) 687