All Versions
85
Latest Version
Avg Release Cycle
30 days
Latest Release
43 days ago

Changelog History
Page 1

  • v4.3.1

    January 07, 2020

    2019-01-07

    • Fix: Don't crash with a NullPointerException when a web socket is closed before it connects. This regression was introduced in OkHttp 4.3.0.
    • Fix: Don't crash with an IllegalArgumentException when using custom trust managers on Android 10. Android uses reflection to look up a magic checkServerTrusted() method and we didn't have it.
    • Fix: Explicitly specify the remote server name when making HTTPS connections on Android 5. In 4.3.0 we introduced a regression where server name indication (SNI) was broken on Android 5.
  • v4.3.0

    December 31, 2019

    2019-12-31

    • Fix: Degrade HTTP/2 connections after a timeout. When an HTTP/2 stream times out it may impact the stream only or the entire connection. With this fix OkHttp will now send HTTP/2 pings after a stream timeout to determine whether the connection should remain eligible for pooling.

    • Fix: Don't call EventListener.responseHeadersStart() or responseBodyStart() until bytes have been received. Previously these events were incorrectly sent too early, when OkHttp was ready to read the response headers or body, which mislead tracing tools. Note that the responseFailed() event always used to follow one of these events; now it may be sent without them.

    • New: Upgrade to Kotlin 1.3.61.

    • New: Match any number of subdomains with two asterisks in CertificatePinner. For example, **.squareup.com matches us-west.www.squareup.com, www.squareup.com and squareup.com.

    • New: Share threads more aggressively between OkHttp's HTTP/2 connections, connection pool, web sockets, and cache. OkHttp has a new internal task runner abstraction for managed task scheduling. In your debugger you will see new thread names and more use of daemon threads.

    • Fix: Don't drop callbacks on unexpected exceptions. When an interceptor throws an unchecked exception the callback is now notified that the call was canceled. The exception is still sent to the uncaught exception handler for reporting and recovery.

    • Fix: Un-deprecate MockResponse.setHeaders() and other setters. These were deprecated in OkHttp 4.0 but that broke method chaining for Java callers.

    • Fix: Don't crash on HTTP/2 HEAD requests when the Content-Length header is present but is not consistent with the length of the response body.

    • Fix: Don't crash when converting a HttpUrl instance with an unresolvable hostname to a URI. The new behavior strips invalid characters like " and { from the hostname before converting.

    • Fix: Undo a performance regression introduced in OkHttp 4.0 caused by differences in behavior between Kotlin's assert() and Java's assert(). (Kotlin always evaluates the argument; Java only does when assertions are enabled.)

    • Fix: Honor RequestBody.isOneShot() in HttpLoggingInterceptor.

  • v4.2.2

    October 06, 2019

    2019-10-06

    • Fix: When closing a canceled HTTP/2 stream, don't send the END_STREAM flag. This could cause the server to incorrectly interpret the stream as having completed normally. This is most useful when a request body needs to cancel its own call.
  • v4.2.1

    October 02, 2019

    2019-10-02

    • Fix: In 4.1.0 we introduced a performance regression that prevented connections from being pooled in certain situations. We have good test coverage for connection pooling but we missed this because it only occurs if you have proxy configured and you share a connection pool among multiple OkHttpClient instances.

      This particularly-subtle bug was caused by us assigning each OkHttpClient instance its own NullProxySelector when an explicit proxy is configured. But we don't share connections when the proxy selectors are different. Ugh!

  • v4.2.0

    September 10, 2019

    2019-09-10

    • New: API to decode a certificate and private key to create a HeldCertificate. This accepts a string containing both a certificate and PKCS #8-encoded private key.

      val heldCertificate = HeldCertificate.decode("""
          |-----BEGIN CERTIFICATE-----
          |MIIBYTCCAQegAwIBAgIBKjAKBggqhkjOPQQDAjApMRQwEgYDVQQLEwtlbmdpbmVl
          |cmluZzERMA8GA1UEAxMIY2FzaC5hcHAwHhcNNzAwMTAxMDAwMDA1WhcNNzAwMTAx
          |MDAwMDEwWjApMRQwEgYDVQQLEwtlbmdpbmVlcmluZzERMA8GA1UEAxMIY2FzaC5h
          |cHAwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAASda8ChkQXxGELnrV/oBnIAx3dD
          |ocUOJfdz4pOJTP6dVQB9U3UBiW5uSX/MoOD0LL5zG3bVyL3Y6pDwKuYvfLNhoyAw
          |HjAcBgNVHREBAf8EEjAQhwQBAQEBgghjYXNoLmFwcDAKBggqhkjOPQQDAgNIADBF
          |AiAyHHg1N6YDDQiY920+cnI5XSZwEGhAtb9PYWO8bLmkcQIhAI2CfEZf3V/obmdT
          |yyaoEufLKVXhrTQhRfodTeigi4RX
          |-----END CERTIFICATE-----
          |-----BEGIN PRIVATE KEY-----
          |MEECAQAwEwYHKoZIzj0CAQYIKoZIzj0DAQcEJzAlAgEBBCA7ODT0xhGSNn4ESj6J
          |lu/GJQZoU9lDrCPeUcQ28tzOWw==
          |-----END PRIVATE KEY-----
          """.trimMargin())
      val handshakeCertificates = HandshakeCertificates.Builder()
          .heldCertificate(heldCertificate)
          .build()
      val server = MockWebServer()
      server.useHttps(handshakeCertificates.sslSocketFactory(), false)
      

      Get these strings with HeldCertificate.certificatePem() and privateKeyPkcs8Pem().

    • Fix: Handshake now returns peer certificates in canonical order: each certificate is signed by the certificate that follows and the last certificate is signed by a trusted root.

    • Fix: Don't lose HTTP/2 flow control bytes when incoming data races with a stream close. If this happened enough then eventually the connection would stall.

    • Fix: Acknowledge and apply inbound HTTP/2 settings atomically. Previously we had a race where we could use new flow control capacity before acknowledging it, causing strict HTTP/2 servers to fail the call.

  • v4.1.1

    September 05, 2019

    2019-09-05

    • Fix: Don't drop repeated headers when validating cached responses. In our Kotlin upgrade we introduced a regression where we iterated the number of unique header names rather than then number of unique headers. If you're using OkHttp's response cache this may impact you.
  • v4.1.0

    August 12, 2019

    2019-08-12

    • OkHttp's new okhttp-brotli module implements Brotli compression. Install the interceptor to enable Brotli compression, which compresses 5-20% smaller than gzip.

      val client = OkHttpClient.Builder()
          .addInterceptor(BrotliInterceptor)
          .build()
      

      This artifact has a dependency on Google's Brotli decoder (95 KiB).

    • New: EventListener.proxySelectStart(), proxySelectEnd() events give visibility into the proxy selection process.

    • New: Response.byteString() reads the entire response into memory as a byte string.

    • New: OkHttpClient.x509TrustManager accessor.

    • New: Permit [new WebSocket response codes][iana_websocket]: 1012 (Service Restart), 1013 (Try Again Later), and 1014 (invalid response from the upstream).

    • New: Build with Kotlin 1.3.41, BouncyCastle 1.62, and Conscrypt 2.2.1.

    • Fix: Recover gracefully when a a coalesced connection immediately goes unhealthy.

    • Fix: Defer the SecurityException when looking up the default proxy selector.

    • Fix: Don't use brackets formatting IPv6 host names in MockWebServer.

    • Fix: Don't permit cache iterators to remove entries that are being written.

  • v4.0.1

    July 10, 2019

    2019-07-10

    • Fix: Tolerate null-hostile lists in public API. Lists created with List.of(...) don't like it when you call contains(null) on them!
    • Fix: Retain binary-compatibility in okhttp3.internal.HttpHeaders.hasBody(). Some unscrupulous coders call this and we don't want their users to suffer.
  • v4.0.0

    June 27, 2019

    2019-06-26

    🚀 This release upgrades OkHttp to Kotlin. We tried our best to make fast and safe to upgrade from OkHttp 3.x. We wrote an [upgrade guide][upgrading_to_okhttp_4] to help with the migration and a [blog post][okhttp4_blog_post] to explain it.

    • Fix: Target Java 8 bytecode for Java and Kotlin.
  • v4.0.0-RC3

    June 24, 2019

    2019-06-24

    • Fix: Retain binary-compatibility in okhttp3.internal.HttpMethod. Naughty third party SDKs import this and we want to ease upgrades for their users.