okhttp v5.0.0-alpha.8 Release Notes

  • 2022-06-08

    • Fix: Change how H2_PRIOR_KNOWLEDGE works with HTTP proxies. Previously OkHttp assumed the proxy itself was a prior knowledge HTTP/2 server. With this update, OkHttp attempts a CONNECT tunnel just as it would with HTTPS. For prior knowledge with proxies OkHttp's is now consistent with these curl arguments:

      curl \
        --http2-prior-knowledge \
        --proxy localhost:8888 \
        --proxytunnel \
    • Fix: Support executing OkHttp on kotlin-stdlib versions as old as 1.4. The library still builds on up-to-date Kotlin releases (1.6.21) but no longer needs that version as a runtime dependency. This should make it easier to use OkHttp in Gradle plugins.

    • Fix: Don't start the clock on response timeouts until the request body is fully transmitted. This is only relevant for duplex request bodies, because they are written concurrently when reading the response body.

    • New: MockResponse.inTunnel() is a new mockwebserver3 API to configure responses that are served while creating a proxy tunnel. This obsoletes both the tunnelProxy argument on MockWebServer and the UPGRADE_TO_SSL_AT_END socket option. (Only APIs on mockwebserver3 are changed; the old okhttp3.mockwebserver APIs remain as they always have been.