OkHttp v4.4.0 Release Notes

Release Date: 2020-02-17 // about 4 years ago
  • 2020-02-17

    • New: Support canceled() as an event that can be observed by EventListener. This should be useful for splitting out canceled calls in metrics.

    • New: Publish a [bill of materials (BOM)][bom] for OkHttp. Depend on this from Gradle or Maven to keep all of your OkHttp artifacts on the same version, even if they're declared via transitive dependencies. You can even omit versions when declaring other OkHttp dependencies.

      dependencies {
         api(platform("com.squareup.okhttp3:okhttp-bom:4.4.0"))
         api("com.squareup.okhttp3:okhttp")              // No version!
         api("com.squareup.okhttp3:logging-interceptor") // No version!
      }
      
    • New: Upgrade to Okio 2.4.3.

      implementation("com.squareup.okio:okio:2.4.3")
      
    • Fix: Limit retry attempts for HTTP/2 REFUSED_STREAM and CANCEL failures.

    • Fix: Retry automatically when incorrectly sharing a connection among multiple hostnames. OkHttp shares connections when hosts share both IP addresses and certificates, such as squareup.com and www.squareup.com. If a server refuses such sharing it will return HTTP 421 and OkHttp will automatically retry on an unshared connection.

    • Fix: Don't crash if a TLS tunnel's response body is truncated.

    • Fix: Don't track unusable routes beyond their usefulness. We had a bug where we could track certain bad routes indefinitely; now we only track the ones that could be necessary.

    • Fix: Defer proxy selection until a proxy is required. This saves calls to ProxySelector on calls that use a pooled connection.