Skip to content
CAI
Software that uses CAICheck a score

square/okhttp

54.1

Weak · 23 October 2026

54.7k

lines of production code

Kotlin

with Java

6

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is OkHttp, a high-performance HTTP and WebSocket client library for Java and Android applications. It provides core networking capabilities including HTTP/1.1, HTTP/2, and WebSocket support, along with advanced features like DNS over HTTPS, TLS certificate management, and Brotli/Zstd compression. The library also includes a comprehensive testing framework via MockWebServer and extensive tooling for integration with modern build systems, GraalVM native images, and Kotlin coroutines.

How it got here

2012–2020 — Modernization and testing infrastructure

46 changes.

The project underwent a significant build system migration to Gradle Kotlin DSL and modernized its tooling while introducing a new public API for MockWebServer. Extensive efforts were made to enhance testing capabilities, including comprehensive sample code, fuzzing suites, and Android instrumentation tests, alongside internal refactoring of TLS and compression components.

2021–2023 — API stabilization and native image support

33 changes.

This period focused on formalizing public API contracts across multiple modules using binary compatibility validators to ensure stable interfaces. It also introduced significant new capabilities, including GraalVM native image support, third-party TLS provider integration, and Kotlin Coroutines extensions. Concurrently, extensive test coverage was added and migrated to Kotlin to validate these features and maintain robustness.

2024–2025 — Kotlin migration and platform split

30 changes.

This period focused on migrating core OkHttp classes to Kotlin and splitting the API into distinct Android and JVM variants. It introduced new features such as Kotlin coroutine support, Zstandard compression, and Encrypted Client Hello, while establishing robust test coverage across JVM, Android, and native-image environments.

2026 — Build modernization and testing infrastructure

10 changes.

The project modernized its Gradle build system by decoupling convention plugins and adopting Java 21, while introducing utility properties for configuration. Significant effort was dedicated to expanding test coverage, including new DNS implementation tests, Android ECH samples, and a comprehensive in-memory fake network and TLS stack for isolated testing.

Features

Add Crawler sample demonstrating parallel HTML fetching with caching

A new Crawler sample application has been added to the samples/crawler directory. It demonstrates how to use OkHttpClient with a local Cache and call timeouts to fetch HTML content from a root URL, follow links in parallel using a thread pool, and respect host limits to avoid overloading servers. The sample uses Jsoup to parse HTML and filters out non-HTML resources to save bandwidth.

samples/crawler · high confidence

Add JUnit 4 integration for MockWebServer

Users can now use MockWebServer in JUnit 4 tests via the new \MockWebServerRule\ class, which automatically starts and stops the server for each test method. This change also introduces a Java 9 module descriptor (\module-info.java\) for the \mockwebserver3.junit4\ module, enabling proper module support for this integration.

mockwebserver-junit4/src/main · high confidence

Add Maven test module with Maven Wrapper v3.3.4 and Maven 4.0.0-rc-7

A new Maven test module has been added to the project, including the Maven Wrapper (v3.3.4) and configuration files that pin the Maven distribution to version 4.0.0-rc-7. The module contains a sample OkHttp client implementation and a corresponding JUnit test that validates HTTP interactions using MockWebServer, providing a dedicated environment for testing Maven-based builds and dependencies.

maven-tests · high confidence

Add OkHttpContributors sample using Moshi for JSON parsing

The simple-client sample now includes OkHttpContributors.java, which demonstrates fetching GitHub repository contributors and deserializing the JSON response using Moshi instead of manual parsing. This change introduces a dependency on the Moshi library for type-safe JSON handling and utilizes try-with-resources for proper response closure.

samples/simple-client · high confidence

Add Slack API sample demonstrating OAuth and real-time messaging

A new sample application in the \samples/slack\ directory demonstrates how to integrate with the Slack API using OkHttp. It includes an \OAuthSessionFactory\ that runs a local \MockWebServer\ to handle the OAuth callback flow, a \SlackApi\ client for REST calls (including JSON parsing via Moshi), and an \RtmSession\ class that establishes a WebSocket connection for real-time messaging. The sample also provides a \SlackClient\ entry point that orchestrates the OAuth authorization and RTM session startup.

samples/slack · high confidence

Add UNIX domain socket sample for OkHttp and MockWebServer

The samples/unixdomainsockets directory now includes a complete example demonstrating how to use OkHttp and MockWebServer over UNIX domain sockets. The sample introduces custom socket factories (UnixDomainSocketFactory and UnixDomainServerSocketFactory) and a TunnelingUnixSocket implementation to impersonate TCP-style connections, and configures both the client and server to use HTTP/2 prior knowledge (Protocol.H2\_PRIOR\_KNOWLEDGE).

samples/unixdomainsockets · high confidence

Add Zstandard (zstd) compression support

OkHttp now supports Zstandard (zstd) encoding via the new \okhttp3.zstd.Zstd\ object, which implements \CompressionInterceptor.DecompressionAlgorithm\. Users can enable zstd decompression by passing \Zstd.INSTANCE\ to the \CompressionInterceptor\ alongside existing algorithms like Gzip and Brotli. This allows OkHttp to automatically decompress HTTP responses encoded with zstd, reducing bandwidth usage for compatible servers.

okhttp-zstd/src · high confidence

Add android-test-app for multi-process and ProGuard validation

The android-test-app module has been added to provide a dedicated environment for testing OkHttp on Android. It includes a test application that initializes OkHttp in secondary processes, activities to demonstrate multi-process behavior, and instrumentation tests for IDNA hostname resolution and public suffix database lookups. Additionally, ProGuard rules are configured to preserve the IDNA mapping table and suppress warnings, ensuring the library functions correctly when code shrinking and obfuscation are enabled.

android-test-app · high confidence

Add fuzzing test infrastructure for WebSocket compliance

Added a new fuzzing test suite in the fuzzing directory to validate WebSocket implementation against the Autobahn Test Suite. This includes a configuration file (fuzzingserver-config.json) that defines the test cases to run and exclude, an expected results file (fuzzingserver-expected.txt) documenting current compliance status, and shell scripts to automate the test execution and update expected results. This allows users to verify their WebSocket client behavior against standard conformance tests.

fuzzing · high confidence

Add static file server sample using OkHttp MockWebServer

A new SampleServer utility has been added to the static-server sample, demonstrating how to serve static files and directory listings over HTTPS using OkHttp's MockWebServer. The server accepts a keystore, password, root directory, and port as command-line arguments, dispatching file content with appropriate MIME types or generating simple HTML directory indexes.

static-server · high confidence

Added GraalVM native-image configuration for OkHttp

OkHttp now includes native-image configuration files to support building native executables. This adds reflection rules for Kotlin runtime classes, registers the PublicSuffixDatabase resource, and sets build arguments to enable HTTP/HTTPS and add all charsets, allowing users to compile OkHttp into native images with GraalVM.

okhttp/src/jvmMain/resources · high confidence

Added Java 9+ module descriptors (module-info.java) across OkHttp components

This change introduces module-info.java files for the core OkHttp library and its extensions (including mockwebserver, mockwebserver-deprecated, okhttp-brotli, okhttp-dnsoverhttps, okhttp-java-net-cookiejar, okhttp-logging-interceptor, okhttp-sse, okhttp-tls, and okhttp-urlconnection), as well as a dedicated module-tests module. By defining explicit module names and their requires/exports relationships, these files enable the libraries to be used as Java Platform Modules (JPMS) on Java 9 and later, allowing developers to build modular applications that depend on OkHttp with proper encapsulation and service resolution.

(repo-wide) · high confidence

Added build configuration utility properties

A new Kotlin utility file (OkHttpBuildUtils.kt) was added to the build-logic module to expose project-level properties for build configuration. This includes defaults for the target platform (jdk9), test Java version (21), Android build flag, and ALPN boot version, allowing these settings to be easily overridden via Gradle properties.

build-logic/src/main/kotlin/okhttp3 · high confidence

Added build tooling for compact IDNA mapping table generation

This module provides the supporting tools and data structures required to build a compact IDNA mapping table from the Unicode IDNA Compatible Preprocessing data (UTS \#46). It includes a code generator that reads the raw mapping table text, processes it into optimized sections, ranges, and mappings, and outputs the resulting Kotlin code. This module is a build-time dependency and is not required for runtime IDN mappings.

okhttp-idna-mapping-table · high confidence

Added sample code for GET and POST requests

New example files, GetExample.java and PostExample.java, have been added to the samples/guide directory to demonstrate how to perform HTTP GET and POST operations using the OkHttpClient. These samples illustrate basic request construction, execution, and response handling for users learning the library.

samples/guide/src/main/java/okhttp3/guide · high confidence

Android platform integration and ECH support

OkHttp now includes a dedicated Android module that provides automatic initialization via AndroidX Startup, ensuring the application context is available for features like cookies and domain handling. It introduces AndroidDns, which leverages the Android system resolver and supports Encrypted Client Hello (ECH) on API 37+ by querying HTTPS records. The library also adds platform-specific TLS socket adapters (Android10SocketAdapter and Android17SocketAdapter) to handle modern TLS features and ECH configuration, while updating logging and certificate chain cleaning to use native Android APIs for better performance and compatibility.

okhttp/src/androidMain · high confidence

DNS over HTTPS implementation with service metadata and bootstrap support

The \DnsOverHttps\ module now provides a complete DNS over HTTPS implementation that supports Encrypted Client Hello (ECH) via the new \includeServiceMetadata\ configuration option, allowing clients to retrieve HTTPS DNS records. It also introduces a \BootstrapDns\ mechanism to handle initial connections to the DNS server using hardcoded hosts or the system DNS, ensuring reliable resolution even before the DoH endpoint is fully established. Users can configure IPv6 inclusion, POST vs GET methods, and address resolution scopes (private/public) through the builder API.

okhttp-dnsoverhttps/src/main/kotlin/okhttp3/dnsoverhttps · high confidence

Expose OkHttp version constant on JVM

The JVM-specific implementation of the OkHttp object now exposes the library's version string via a public \VERSION\ field. This allows applications running on the JVM to programmatically retrieve the current OkHttp version at runtime.

okhttp/src/jvmMain/kotlin/okhttp3 · high confidence

GraalVM Native Image support for OkHttp

OkHttp now includes built-in support for building native images using GraalVM. This change adds configuration classes that automatically register necessary resources and substitute platform-specific implementations (such as BouncyCastle, Conscrypt, and OpenJSSE) to ensure compatibility during the native image build process.

okhttp/src/jvmMain/kotlin/okhttp3/internal/graal · high confidence

Initial Gradle wrapper configuration for version 9.8.1

The project now includes a Gradle wrapper configuration file that sets the build tool to version 9.8.1. This ensures that all users and CI environments download and use this specific version of Gradle, providing consistent build behavior and eliminating dependency on locally installed Gradle versions.

gradle/wrapper · high confidence

Initial repository structure and documentation site

The repository is initialized with the core project files, including the Apache 2.0 license, README, and a comprehensive CHANGELOG documenting versions from 1.0.2 through 5.5.0. A new MkDocs-based documentation site is added, featuring a Material theme, navigation structure, and a deployment script (\deploy\_website.sh\) to generate and publish API docs and changelogs. The project also includes standard build infrastructure (Gradle wrapper, \.editorconfig\, \.gitignore\) and a \BUG-BOUNTY.md\ file.

(repo-wide) · high confidence

Introduce Brotli compression support

This change adds the public API for Brotli compression, defining the \okhttp3.brotli.Brotli\ class (which implements \CompressionInterceptor.DecompressionAlgorithm\) and the \okhttp3.brotli.BrotliInterceptor\ singleton. Users can now utilize these classes to enable Brotli decompression in their HTTP client configurations.

okhttp-brotli/api · high confidence

Introduce OkCurl as a GraalVM-native curl clone for testing OkHttp

OkCurl is now available as a curl-like tool backed by OkHttp, allowing users to test OkHttp's HTTP engine (including HTTP/2) against web servers. The tool is distributed as a shell script that builds and runs a GraalVM native image, requiring GRAALVM\_HOME to be set for local execution.

okcurl · high confidence

Introduce TLS cipher suite survey sample

The tlssurvey sample now includes a new set of Kotlin classes (CipherSuiteSurvey, IanaSuites, Client, SuiteId) that fetch IANA TLS parameter data and organize SSL cipher suite inclusion and precedence for a spreadsheet view.

tlssurvey · high confidence

Introduce internal ASN.1 DER decoder and encoder

OkHttp now includes a built-in, internal ASN.1 DER decoder and encoder in the \okhttp3.tls.internal.der\ package. This new implementation replaces the previous reliance on Bouncy Castle for DER parsing and encoding, allowing OkHttp to handle certificate structures (such as X.509 certificates) and other ASN.1 data natively. The change improves performance and reduces the library's external dependency footprint by handling DER serialization and deserialization directly within OkHttp's TLS module.

okhttp-tls/src/main/kotlin/okhttp3/tls/internal/der · high confidence

Introduce okcurl CLI tool with comprehensive HTTP and debugging options

The okcurl command-line interface is now available, allowing users to execute HTTP requests using OkHttp with a curl-like syntax. This tool supports standard options such as specifying request methods, POST data, custom headers, and user agents, along with fine-grained control over connection, read, and call timeouts. It includes features to follow redirects, include protocol headers in output, and bypass SSL certificate verification for insecure connections. For troubleshooting, users can enable verbose logging, HTTP/2 frame inspection, and detailed SSL debug output, providing deep visibility into the request lifecycle and network interactions.

okcurl/src/main/kotlin · high confidence

Introduces mockwebserver3 package with new public API surface

This change introduces the \mockwebserver3\ package, providing a new public API for the mock web server. The core components include \MockWebServer\ for starting and configuring the server, \Dispatcher\ and \QueueDispatcher\ for handling requests and managing response queues, and \MockResponse\ for scripting responses with support for headers, bodies, delays, and socket effects. New types like \RecordedRequest\ expose detailed request information, while \MockResponseBody\ and \SocketHandler\ allow for custom response body handling and duplex streams. Internal classes like \MockWebServerSocket\ and \ThrottledSink\ support the underlying network simulation.

mockwebserver/src/main/kotlin · high confidence

Java 9+ module support for OkHttp

OkHttp now includes a module-info.java file, enabling it to be used as a Java Platform Module System (JPMS) module. This change defines the module 'okhttp3' and explicitly exports internal packages (such as internal.dns, internal.http, and internal.platform) to specific companion modules like okhttp3.dnsoverhttps, mockwebserver3, and okhttp3.logging, ensuring proper encapsulation and access for users leveraging Java 9+ features.

okhttp/src/jvmMain/java9 · high confidence

Native image configuration for GraalVM

OkHttp now includes a native-image.properties file that configures GraalVM native image builds. This configuration enables HTTP and HTTPS protocols, adds support for all character sets, and registers the OkHttp-specific GraalVM feature to ensure proper runtime behavior in native images.

okhttp/src/main · high confidence

New @StartStop annotation for JUnit 5 lifecycle management

A new @StartStop annotation has been added to the mockwebserver-junit5 API, enabling users to control the lifecycle of the MockWebServer instance within JUnit 5 tests. This allows for explicit starting and stopping of the server around test execution, providing finer control over the test environment setup and teardown.

mockwebserver-junit5/api · high confidence

New @StartStop annotation for automatic MockWebServer lifecycle in JUnit 5

Users can now annotate MockWebServer fields with @StartStop to have the server automatically started before each test and stopped after the test completes. This new JUnit 5 extension supports both instance fields (for individual tests) and static fields (for the entire test class), and correctly handles nested test classes by ensuring servers in enclosing instances are also started. A module-info.java file is added to support Java Modules.

mockwebserver-junit5/src · high confidence

New JavaNetCookieJar bridges Java's CookieHandler to OkHttp

A new JavaNetCookieJar implementation is introduced in the okhttp-java-net-cookiejar module, allowing users to delegate cookie storage and retrieval to the standard java.net.CookieHandler. This enables seamless integration with the platform's native cookie management, handling both saving cookies from responses and loading them for requests by converting between OkHttp's Cookie objects and Java's HttpCookie format.

okhttp-java-net-cookiejar/src/main/kotlin · high confidence

New Kotlin recipe samples for OkHttp documentation

Added a comprehensive set of Kotlin source files to the OkHttp guide samples directory, providing idiomatic examples for common HTTP tasks. These new recipes cover synchronous and asynchronous requests, header access, authentication (including Yubikey client auth), caching, call cancellation, certificate pinning, timeout configuration, per-call settings, and various POST methods (file, form, multipart, streaming, and string uploads with progress tracking).

samples/guide/src/main/java/okhttp3/recipes/kt · high confidence

New LoggingEventListener for detailed call lifecycle logging

The logging interceptor module now includes a new LoggingEventListener class that logs detailed OkHttp call events (such as DNS, connection, and body transfer phases) via the existing HttpLoggingInterceptor.Logger interface, allowing users to attach it as an eventListenerFactory to track the full lifecycle of HTTP calls.

okhttp-logging-interceptor/src/main/kotlin · high confidence

New LoggingFilesystem for Okio integration testing

A new LoggingFilesystem class has been added to the okhttp-testing-support module to facilitate testing of Okio filesystem operations. This class extends ForwardingFileSystem and overrides key methods (such as sink, source, delete, createDirectory, atomicMove, and appendingSink) to log each operation via println before delegating to the underlying filesystem, allowing developers to verify file system interactions during tests.

okhttp-testing-support/src/main/kotlin/okhttp3/okio · high confidence

New OkHttp 3 recipe samples for common HTTP tasks

The samples/guide/src/main/java/okhttp3/recipes directory now includes a comprehensive set of Java recipes demonstrating OkHttp 3 usage. These new examples cover essential patterns such as accessing response headers, performing asynchronous GET requests, handling HTTP authentication, configuring client-side caching, and canceling in-flight calls. Additional samples illustrate advanced configuration including setting custom timeouts, pinning SSL certificates, customizing cipher suites, and establishing custom trust relationships with specific root certificates. The collection also provides practical examples for interceptors (logging and date headers), parsing JSON responses with Moshi, managing per-call settings, and executing various POST methods (files, forms, multipart, streaming, and strings).

samples/guide/src/main/java/okhttp3/recipes · high confidence

New TLS certificate utilities and builder classes

The okhttp-tls module introduces new Kotlin files for handling TLS certificates: Certificates.kt provides extension functions to decode PEM-encoded certificates and encode X.509 certificates to PEM format; HandshakeCertificates.kt defines a builder pattern for configuring trusted roots, insecure hosts, and held certificates for TLS handshakes; HeldCertificate.kt offers a class to manage a certificate and its private key, with methods to export them in PKCS\#8 and PKCS\#1 PEM formats. These changes add new capabilities for certificate manipulation and TLS configuration within the okhttp-tls library.

okhttp-tls/src/main/kotlin/okhttp3/tls · high confidence

New TLS survey sample for comparing cipher suites across clients

The samples/tlssurvey module now includes a new Kotlin-based tool that surveys and compares TLS cipher suite support across various clients. It fetches data from the SSL Labs API to identify enabled suites for browsers (Chrome, Firefox, Safari) and platforms (Android, Java), and compares these against OkHttp versions (3.9, 3.11, 3.13, 3.14, 4.10) and the current JVM. The sample also supports checking the Conscrypt provider and outputs the results to a Google Sheet.

samples/tlssurvey · high confidence

New TaskFaker and TaskRunnerTesting utilities for deterministic testing

Added TaskFaker, a test utility that runs TaskRunner tasks sequentially and deterministically to allow controlled, single-threaded testing of concurrent logic, and TaskRunnerTesting, which provides a Kotlin-friendly schedule extension for TaskRunner to simplify test setup.

okhttp-testing-support/src/main/kotlin/okhttp3/internal/concurrent · high confidence

New duplex testing utilities for HTTP/1.1 connection upgrades

Added \AsyncRequestBody\ and \MockSocketHandler\ classes to the \okhttp-testing-support\ module to facilitate testing of duplex request bodies and HTTP/1.1 connection upgrades. \AsyncRequestBody\ allows test code to capture and later write to the request body's sink, while \MockSocketHandler\ provides a scriptable interface for defining specific request and response behaviors in socket-level tests.

okhttp-testing-support/src/main/kotlin/okhttp3/internal/duplex · high confidence

New executeAsync extension for Kotlin Coroutines

The library now exposes a public API for executing HTTP calls asynchronously using Kotlin Coroutines. Specifically, the \okhttp3.coroutines.ExecuteAsyncKt\ class provides an \executeAsync\ function that accepts an \okhttp3.Call\ and a \kotlin.coroutines.Continuation\, allowing users to integrate OkHttp requests directly into coroutine flows.

okhttp-coroutines/api · high confidence

New executeAsync() extension for suspending HTTP calls

The okhttp-coroutines module now provides an \executeAsync()\ extension function on \okhttp3.Call\, allowing users to perform synchronous-style HTTP requests within Kotlin coroutines without blocking threads. This new API wraps the existing asynchronous \enqueue\ callback mechanism using \suspendCancellableCoroutine\, ensuring that the underlying call is cancelled if the coroutine is cancelled and that the response body is properly closed. The implementation is located in the \okhttp3.coroutines\ package and includes a Java 9 module descriptor to support Java Modules.

okhttp-coroutines/src · high confidence

New guide samples for event logging, streaming, and security

The guide now includes new recipe samples demonstrating how to log detailed connection events via EventListener (PrintEvents), stream request bodies asynchronously using Okio pipes (PostStreamingWithPipe), intercept requests for preemptive basic authentication (PreemptiveAuth), validate peer certificates against a denylist (CheckHandshake), configure custom trust anchors with HandshakeCertificates (CustomTrust), test against local HTTPS servers with insecure host exceptions (DevServer), parse JSON responses with Moshi (ParseResponseWithMoshi), upload files using Okio Path APIs (PostPath), and capture TLS keys for Wireshark decryption (WiresharkExample).

guide · high confidence

New in-memory fake network and TLS stack for testing

Added a complete in-memory socket system to the testing support library, allowing OkHttp to be tested without using operating system TCP sockets. This includes \FakeNetwork\ for managing in-memory connections, \FakeSocket\ and \FakeServerSocket\ to simulate network endpoints, and a fake TLS stack (\FakeTls\, \FakeSslSocket\, \Handshaker\) to handle TLS handshakes and configuration in isolation. The suite also provides delegating wrappers for standard Java socket factories (\DelegatingSocketFactory\, \DelegatingSSLSocketFactory\, etc.) to facilitate socket configuration during tests.

okhttp-testing-support/src/main/kotlin/okhttp3/sockets · high confidence

New testing support for structured call and connection events

The testing support library now includes a structured event system for observing HTTP call and connection lifecycles. Callers can use the new \CallEvent\ sealed class hierarchy and \ConnectionEvent\ types to inspect detailed, timestamped data for every phase of a request (such as DNS, proxy selection, connection acquisition, and body transfer) and connection state changes. The \EventListenerAdapter\ bridges the existing \EventListener\ API to these new data classes, while \EventRecorder\ and \RecordingConnectionListener\ provide utilities for asserting event sequences and timing in tests. Additionally, \ClientRuleEventListener\ offers a convenient way to log these events for debugging, and \EventListenerRelay\ helps detect bugs where listeners are cached incorrectly.

okhttp-testing-support/src/main/kotlin/okhttp3 · high confidence

Support for third-party TLS providers on JVM

OkHttp now detects and uses BouncyCastle, Conscrypt, and OpenJSSE TLS providers when they are installed as the first security provider on the JVM classpath. This allows users to leverage these alternative cryptographic implementations for TLS connections, with the platform registry automatically selecting the appropriate provider based on availability and preference order.

okhttp/src/jvmMain/kotlin/okhttp3/internal/platform · high confidence

API

Establish binary compatibility API for SSE module

The \okhttp-sse\ module now publishes a formal binary compatibility API file (\okhttp-sse.api\) that explicitly defines the public surface of the Server-Sent Events implementation. This file locks in the signatures for \EventSource\, \EventSource.Factory\, \EventSourceListener\, and the \EventSources\ utility class, ensuring that future internal refactors or implementation changes do not inadvertently break existing client code that relies on these specific public interfaces.

okhttp-sse/api · high confidence

MockWebServer3 public API surface defined

The public API for MockWebServer3 is now explicitly defined in the \mockwebserver3.api\ file, establishing the contract for users. This includes the \Dispatcher\ interface for handling requests, the \MockResponse\ class and its \Builder\ for configuring responses (including headers, body, delays, and HTTP/2 push promises), and the \MockResponseBody\ interface for custom response bodies. The \MockWebServer\ class exposes methods for starting, stopping, and configuring the server (such as protocol negotiation and client auth), while \RecordedRequest\ provides detailed information about incoming requests, including body content as a \ByteString\, connection index, and handshake details. New types like \SocketEffect\ and \PushPromise\ are also part of this public surface, enabling more granular control over socket behavior and HTTP/2 features.

mockwebserver/api · high confidence

Publish public API surface for logging-interceptor

The \okhttp-logging-interceptor\ module now publishes its public API signature via the \logging-interceptor.api\ file, establishing the binary compatibility baseline for the \HttpLoggingInterceptor\, \LoggingEventListener\, and related classes. This change formalizes the public contract for users relying on these components, ensuring that future updates maintain compatibility with the existing \HttpLoggingInterceptor$Level\ enum, \Logger\ interface, and event listener factory.

okhttp-logging-interceptor/api · high confidence

Architecture

Establish binary compatibility API snapshots for okhttp-tls and okhttp-urlconnection

New API signature files have been added for the okhttp-tls and okhttp-urlconnection modules to formally record their public binary interfaces. For okhttp-tls, the snapshot documents the public API for certificate handling classes including Certificates, HandshakeCertificates (with its Builder), and HeldCertificate (with its Builder), ensuring that future changes to these types are validated against this baseline. For okhttp-urlconnection, the snapshot records the public API for the JavaNetAuthenticator and JavaNetCookieJar adapter classes. These files serve as a contract for binary compatibility, preventing accidental breaking changes to the public surface of these libraries.

okhttp-tls/api, okhttp-urlconnection/api · high confidence

OkHttp API surface split into Android and JVM variants

The public API definition for OkHttp has been separated into two distinct files: \okhttp/api/android/okhttp.api\ and \okhttp/api/jvm/okhttp.api\. This change reflects the architectural split of the OkHttp core library into Android-specific and JVM-specific modules, ensuring that each platform's public API surface is defined and versioned independently.

okhttp/api · high confidence

Behavioural changes

Added ProGuard rules for OkHttp testing support

A new ProGuard configuration file (okhttp3.pro) has been added to the okhttp-testing-support module to suppress warnings related to optional classes used by the test platform, ensuring cleaner builds when code shrinking is enabled.

okhttp-testing-support/src/main/resources · high confidence

Adopts Java 21 for the Gradle daemon

The Gradle build daemon is now configured to run on Java 21 using the Adoptium vendor toolchain. This change is implemented via a new gradle-daemon-jvm.properties file, ensuring the build process utilizes the specified JDK version for improved performance and compatibility.

gradle · high confidence

BrotliInterceptor now delegates to a reusable CompressionInterceptor

The BrotliInterceptor has been refactored to extend the new reusable CompressionInterceptor, replacing the previous transparent gzip compression logic in BridgeInterceptor. This change consolidates compression handling by having the interceptor manage both Brotli and Gzip decoding through a shared base class, ensuring consistent behavior for decompressing responses encoded with either algorithm.

okhttp-brotli/src/main/kotlin · high confidence

DNS-over-HTTPS query implementation and error handling

The library now includes a concrete implementation of DNS-over-HTTPS queries via the new internal DnsOverHttpsQuery class. This change introduces specific error handling behavior: HTTP errors from the DNS server now throw UnknownHostException, and responses exceeding the maximum size limit throw ProtocolException. It also enforces private/public host resolution rules, throwing UnknownHostException when a query is blocked by these policies, and supports both GET and POST request methods for DNS queries.

okhttp-dnsoverhttps/src/main/kotlin/okhttp3/dnsoverhttps/internal · high confidence

Decoupled Gradle build-logic convention plugins

The build system has been refactored into a set of decoupled convention plugins in the build-logic module to modernize the Gradle configuration and improve build performance. This change introduces dedicated plugins for JVM tooling (configuring Java 21 for builds and Java 8 for targets), multiplatform support (including a workaround for BND/OSGi compatibility with Kotlin Multiplatform), and modularized quality and testing standards (integrating Checkstyle, Animal Sniffer, Spotless, and JUnit 5). It also adds specific logic for OSGi bundle generation, multi-release JAR creation, and API validation, while ensuring compatibility with the Gradle Configuration Cache.

build-logic/src/main/kotlin · high confidence

Deprecate JavaNetAuthenticator and introduce JPMS-compatible JavaNetCookieJar

The JavaNetAuthenticator class is now deprecated in favor of using Authenticator.JAVA\_NET\_AUTHENTICATOR directly. Additionally, a new JavaNetCookieJar implementation is introduced that delegates to an internal class to ensure JPMS compatibility, with users advised to prefer the internal implementation directly.

okhttp-urlconnection/src/main/kotlin · high confidence

Deprecated MockWebServer API surface published

The public API signature file for the deprecated \okhttp3/mockwebserver\ package has been added, documenting the stable interface for classes such as \MockWebServer\, \MockResponse\, \Dispatcher\, and \SocketPolicy\. This file serves as the binary compatibility contract for the legacy module, ensuring that existing users relying on these deprecated components maintain stable access to methods like \enqueue\, \start\, and \takeRequest\ despite underlying implementation changes.

mockwebserver-deprecated/api · high confidence

Deprecated MockWebServer now delegates to mockwebserver3

The \okhttp3.mockwebserver\ package has been refactored to act as a compatibility layer over the new \mockwebserver3\ implementation. Existing users of \MockWebServer\, \MockResponse\, \RecordedRequest\, and \Dispatcher\ will find the same public API, but the underlying behavior is now driven by the new module. This includes mapping legacy \SocketPolicy\ values to the new \SocketEffect\ types and ensuring that request data (such as body and headers) is correctly unwrapped from the new internal structures. This change prepares the deprecated module for eventual removal while maintaining backward compatibility for current test suites.

mockwebserver-deprecated/src/main/kotlin · high confidence

DnsOverHttps API stabilization and configuration updates

The public API for DnsOverHttps is now explicitly defined, exposing configuration options for IPv6 inclusion, private address resolution, and the use of POST requests. The builder now supports setting a custom DnsCache to enable in-memory caching and allows specifying bootstrap DNS hosts. The includeServiceMetadata option is now available to control whether service metadata is included in DNS responses.

okhttp-dnsoverhttps/api · high confidence

EventSources.createFactory is now part of the public API

The \EventSources.createFactory\ method is now explicitly exposed in the public \okhttp3.sse\ package, allowing users to create \EventSource\ instances using a custom \Call.Factory\ or \OkHttpClient\. This change also includes the public definition of the \EventSource\ interface and \EventSourceListener\ abstract class, along with the \EventSources\ utility object which handles the underlying connection logic and ensures the \Accept: text/event-stream\ header is set by default.

okhttp-sse/src/main/kotlin/okhttp3/sse · high confidence

JVM public suffix list uses resource-based loading

On the JVM platform, the public suffix list is now loaded via a resource-based implementation (ResourcePublicSuffixList) instead of the previous method. This change ensures the suffix list is correctly resolved from the classpath resources on JVM environments.

okhttp/src/jvmMain/kotlin/okhttp3/internal/publicsuffix · high confidence

JavaNetCookieJar API surface defined for JPMS compatibility

The public API contract for the \JavaNetCookieJar\ class is now explicitly defined, exposing its constructor and \CookieJar\ methods (\loadForRequest\, \saveFromResponse\) to support Java Platform Module System (JPMS) integration.

okhttp-java-net-cookiejar/api · high confidence

OkHttp core classes migrated to Kotlin

The core OkHttp classes in the common JVM/Android module (including Address, Authenticator, Cache, CacheControl, Call, Callback, CertificatePinner, Challenge, and CipherSuite) have been rewritten in Kotlin. This migration introduces several API changes: properties that were previously Java-style getter methods (e.g., \dns()\, \url()\, \noCache()\) are now direct \val\ properties, with the old methods deprecated at \ERROR\ level to force immediate migration; data structures like protocol lists and connection specs are now returned as immutable lists; and the \Authenticator\ interface has been simplified to a functional interface with a single \authenticate\ method. These changes modernize the codebase and improve interoperability with Kotlin while enforcing stricter API usage for Java consumers.

okhttp/src/commonJvmAndroid · high confidence

Public suffix list generation and testing infrastructure moved to JVM test module

The \PublicSuffixListGenerator\ utility, which downloads and transforms the public suffix list into an efficient format for OkHttp, has been relocated to the JVM test source set (\okhttp/src/jvmTest\). This change includes a fix to the resource path used by the generator to ensure it correctly locates the \public\_suffix\_list.dat\ file. Additionally, a new JVM-specific test runner (\PublicSuffixTestRunner\) and setup function (\beforePublicSuffixTest\) have been added to support running public suffix tests on the JVM platform, aligning with the broader split of OkHttp core into Android and JVM targets.

okhttp/src/jvmTest/kotlin/okhttp3/internal/publicsuffix · high confidence

Refactored insecure host trust management for Android and non-Android platforms

The internal TLS utilities in \okhttp-tls\ have been restructured to handle insecure host bypasses more robustly across different environments. A new \TlsUtil\ object now centralizes trust and key manager creation, delegating to platform-specific implementations: \InsecureAndroidTrustManager\ for Android devices (using reflection to handle API level variations) and \InsecureExtendedTrustManager\ for other platforms (leveraging \X509ExtendedTrustManager\ to inspect socket and SSL engine contexts). This change ensures that certificate verification is correctly skipped only for explicitly listed insecure hosts while maintaining standard security checks for all other connections.

okhttp-tls/src/main/kotlin/okhttp3/tls/internal · high confidence

Server-Sent Events implementation moved to new internal package

The internal implementation of Server-Sent Events has been relocated from \okhttp3.internal.sse\ to \okhttp3.sse.internal\. This change involves the \RealEventSource\ and \ServerSentEventReader\ classes, which handle the connection lifecycle, event parsing, and callback dispatching for SSE streams. Users relying on internal APIs should update their imports accordingly, though public-facing \EventSource\ functionality remains unchanged.

okhttp-sse/src/main/kotlin/okhttp3/sse/internal · high confidence

Stabilize the JUnit 4 API with binary compatibility validation

The JUnit 4 integration now exposes a stable public API for the MockWebServerRule, which extends ExternalResource and provides a getServer method to access the underlying MockWebServer instance. This stability is enforced by adopting Kotlin's binary compatibility validator, ensuring that future changes to this public interface are detected and managed to prevent breaking changes for users relying on this rule.

mockwebserver-junit4/api · high confidence

Version property template for Okcurl

A new version property template file has been added to the Okcurl resources, allowing the application version to be injected at build time via the ${projectVersion} placeholder.

okcurl/src/main/resources-templates · high confidence

Test coverage

Add HPACK test case submodule; Added Android DNS tests with Robolectric shadows; Added Android ECH sample with integration tests; Added Android instrumentation tests for DNS, network pinning, and ECH; Added Android test for Let's Encrypt ISRG Root X1 certificate; Added Android-specific unit tests for OkHttp; Added HPACK interop and round-trip tests in Kotlin; Added HTTP/2 server test utility; Added JUnit 5 tests for BrotliInterceptor; Added JVM TLS tests for certificate pinning, client auth, and hostname verification; Added JVM WebSocket tests for compression, framing, and connection lifecycle; Added JVM platform tests for JDK 8, JDK 9, and base Platform; Added JVM tests for DiskLruCache using Burst; Added JVM tests for HTTP/1.1 upgrades, call cancellation, and thread interruption; Added JVM tests for TaskRunner and IDNA utilities; Added JVM tests for connection pool, route selection, and ECH retry logic; Added JVM tests for the HTTP/2 protocol implementation; Added Kotlin test coverage for MockWebServer; Added Kotlin test for MockWebServerRule lifecycle; Added Kotlin-based unit tests for HttpLoggingInterceptor and LoggingEventListener; Added OSGi resolution and JavaNet authenticator tests; Added TLS certificate and handshake tests in Java and Kotlin; Added baseline HTTP client comparison tests; Added internal test utilities and unit tests for OkHttp internals; Added native-image test suite for OkHttp; Added test for ALPN override on Android; Added test resources for IDN and URL parsing; Added test to verify guide sample main methods; Added tests for Call tag seeding and computation; Added tests for CompressionInterceptor, DNS values, and versioning; Added tests for DNS over HTTPS functionality; Added tests for FakeNetwork and FakeTls testing utilities; Added tests for IsProbablyUtf8 buffer inspection; Added tests for Java module visibility and integration; Added tests for MockWebServer3 core functionality; Added tests for OkHttpClientTestRule behavior; Added tests for PlatformRule validation; Added tests for SNI override behavior on Android; Added tests for SSE event parsing and HTTP integration; Added tests for the Public Suffix Database; Added tests for the internal ASN.1 DER decoder and certificate parsing; Added tests for the new DNS implementation; Migrated JVM tests to JUnit 5 and added comprehensive coverage for new features; Migrated okcurl tests to Kotlin; New RecordingProxySelector test utility added; New regression-test module for Android compatibility verification; New testing support utilities for platform-aware and flaky tests; Updated Robolectric test SDK version.

Dependencies

Migrate build system to Gradle Kotlin DSL and modernize tooling

The project has converted its build configuration from Groovy to Kotlin DSL (build.gradle.kts) and adopted a modern Gradle architecture. This includes decoupling build logic into a \build-logic\ convention plugin module, centralizing dependency and plugin versions in a version catalog (\libs.versions.toml\), and enabling Gradle features like the configuration cache and type-safe project accessors. The migration also upgrades the Android Gradle Plugin to version 9, updates the Kotlin compiler to version 2.2, and integrates Spotless for code formatting across the build scripts.

(dependencies) · high confidence

Housekeeping

Added OkHttp module documentation and ProGuard rules

The OkHttp artifact now includes a Module.md file describing it as an HTTP+HTTP/2 client for Android and Java applications, alongside a new okhttp3.pro file. This ProGuard configuration adds specific -dontwarn directives for JSR 305 annotations, Animal Sniffer dependencies, and internal platform classes related to Conscrypt and Bouncy Castle, ensuring smoother builds for users employing these security providers or testing frameworks like Robolectric.

okhttp · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 57 → 54 (-2.8)

Lenses

  • Code Health 84 → 84 (+0.1)
  • Architecture 80 → 87 (+7.1)
  • Maturity 54 → 59 (+4.1)
  • Readiness 48 → 39 (-8.3)
  • Security 69 → 67 (-1.7)
  • Performance 78 → 78 (+0.0)

Resolved (11)

  • Banned license: org.graalvm.nativeimage:svm
  • Documentation: no installation or build instructions (docs/releasing.md)
  • Hotspot: okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/dns/-DnsMessageReader.kt (okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/dns/-DnsMessageReader.kt)
  • Hotspot: okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/dns/-StateMachineDnsCall.kt (okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/dns/-StateMachineDnsCall.kt)
  • Hotspot: okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/dns/RealDnsCache.kt (okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/dns/RealDnsCache.kt)
  • Inconsistent Factory Method Naming: The client exposes address() to create an Address object, but uses newCall() and newWebSocket() for other objects. While newCall is standard, address() is inconsistent with the new... pattern if it is intended to be a factory. However, Address is often a configuration object, so this might be intentional. A stronger inconsistency is seen in HttpUrl.newBuilder() vs Headers.newBuilder() vs Cache (no builder). This is a broader pattern issue, but specifically address() vs newAddress() (if it existed) would be the check. Here, the inconsistency is less severe than the property/method duplication.
  • Inconsistent Return Types for Collection Access: Cache.urls() returns a MutableIterator, while Dispatcher.queuedCalls() and runningCalls() return List. This forces consumers to handle different collection types for similar 'get all items' operations.
  • Off-boarding risk: anonymized user #1
  • Redundant Method Names: HttpUrl exposes both toUrl()/toUri() and url()/uri(). These methods perform the same conversion. The toXxx naming convention is standard for conversion, while xxx() implies a property accessor. Having both is inconsistent and redundant.
  • Redundant Property/Method Duplication: Every property on the Address class has a corresponding method with the same name and signature. In Kotlin, properties are the standard way to expose state; having both a property and a method with the same name is redundant and confusing for API consumers.
  • Redundant Property/Method Duplication: Similar to Address, Cache exposes both properties and methods for directory and directoryPath. Additionally, exposing both File and Path representations for the same underlying data via both properties and methods creates significant noise and potential for confusion regarding which representation to use.

New (22)

  • Ambiguous Lifecycle/State Management: Cache has delete(), close(), and evictAll(). delete() likely removes the cache directory entirely, close() stops the cache from being used, and evictAll() clears the contents but keeps the directory. While distinct, the naming is slightly ambiguous compared to standard Java Closeable patterns, and urls() returning a MutableIterator is dangerous and inconsistent with the immutable nature of the rest of the API (e.g., Address properties are immutable).
  • Inconsistent Builder Factory Naming: Most types use newBuilder(). However, HttpUrl has an overloaded newBuilder(link: String) which returns a Builder? (nullable). This is inconsistent with the standard newBuilder() pattern which usually returns a non-null builder. Additionally, HttpUrl.newBuilder(link) is a static factory method on the class, whereas others are instance methods or static factories without the 'new' prefix in the overload name (though newBuilder is standard). The main issue is the nullable return type on one overload.
  • Inconsistent Object Construction Pattern: OkHttpClient uses newCall() to create a Call, but uses address() to create an Address. Address is a configuration object, not a call. The naming address() is vague compared to newCall(). It should likely be newAddress() or addressBuilder() if it returns a builder, or simply address() is acceptable if it's a factory, but it breaks the new* convention established by newCall and newWebSocket.
  • Leaked secret: private-key (okhttp-tls/README.md)
  • Leaked secret: private-key (okhttp-tls/src/main/kotlin/okhttp3/tls/HeldCertificate.kt)
  • Leaked secret: private-key (okhttp-tls/src/main/kotlin/okhttp3/tls/HeldCertificate.kt)
  • Off-boarding risk: anonymized user #1
  • Orphaned file (okhttp/src/androidMain/kotlin/okhttp3/internal/platform/android/AndroidCertificateChainCleaner.kt)
  • Orphaned file (okhttp/src/commonJvmAndroid/kotlin/okhttp3/Authenticator.kt)
  • Orphaned file (okhttp/src/commonJvmAndroid/kotlin/okhttp3/CacheControl.kt)
  • Orphaned file (okhttp/src/commonJvmAndroid/kotlin/okhttp3/Connection.kt)
  • Orphaned file (okhttp/src/commonJvmAndroid/kotlin/okhttp3/WebSocket.kt)
  • Orphaned file (okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/concurrent/Task.kt)
  • Orphaned file (okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/concurrent/TaskLogger.kt)
  • Orphaned file (okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/http2/Settings.kt)
  • Orphaned files with no living knowledge
  • Redundant Method Names: HttpUrl exposes toUrl()/toUri() and url()/uri(). These pairs do exactly the same thing (converting to Java URL/URI objects). This is a direct duplication of intent.
  • Redundant Property/Method Pairs: In Kotlin, properties and no-arg methods with the same name are typically aliases. Here, every configuration field in Address is exposed as both a Property and a Method with the exact same signature (e.g., dns and dns()). This doubles the API surface without adding semantic value, confusing users about whether they should use property access or method invocation.
  • Redundant Property/Method Pairs: Same issue as Address. Cache exposes directory and directoryPath as both properties and methods.
  • Repeated repair: okhttp-dnsoverhttps/src/main/kotlin/okhttp3/dnsoverhttps/internal/-DnsOverHttpsQuery.kt (okhttp-dnsoverhttps/src/main/kotlin/okhttp3/dnsoverhttps/internal/-DnsOverHttpsQuery.kt)
  • …and 2 more

Changes since last survey

  • 23 commits — 22 feature/other, 1 fixes

By area

  • gradle/libs.versions.toml — 7 commits
  • .github/workflows — 6 commits
  • okhttp/src — 4 commits
  • (root) — 3 commits
  • .github/CONTRIBUTING.md — 1 commit
  • build-logic/src — 1 commit
  • docs/changelogs — 1 commit

Notable commits

  • fix: Fix invalid proxy hosts causing IllegalArgumentException instead of UnknownHostException (#9775)
  • change: Add 4.12.1 to the changelog
  • change: Add Markdown code and fix script indentation (#9790)
  • change: Blocklist 8 certificates for [CVE redacted] (#9804)
  • change: Delete .github/CONTRIBUTING.md
  • change: Handle null requestedServerNames in Platform.getHandshakeServerNames (#9523) (#9778)
  • change: Make build compatible with Gradle 9.8.1 Isolated Projects (#9807)
  • change: Reject CR and LF in quoted MediaType parameters (#9795)
  • change: Release OkHttp 5.5.1
  • change: Update EnricoMi/publish-unit-test-result-action action to v2.25.0 (#9801)
  • change: Update actions/setup-java action to v6.1.0 (#9809)
  • change: Update actions/upload-artifact action to v7.0.2 (#9792)
  • change: Update de.mannodermaus.junit5 to v2.0.2 (#9810)
  • change: Update dependency com.gradleup.tapmoc:com.gradleup.tapmoc.gradle.plugin to v0.5.0 (#9803)
  • change: Update dependency de.mannodermaus.android-junit5 to v2.0.2 (#9811)
  • change: Update dependency org.apache.httpcomponents.client5:httpclient5 to v5.6.5 (#9789)
  • change: Update dependency org.graalvm.nativeimage:svm to v25.0.4.1.1 (#9802)
  • change: Update graalvm to v1.1.14 (#9722)
  • change: Update graalvm/setup-graalvm action to v1.6.7 (#9785)
  • change: Update ksp monorepo to v2.3.12 (#9757)
  • …and 3 more

Architecture

  • Containers 0 added · 0 removed · contexts 0 added · 0 removed · edges 4 added · 4 removed

Added dependency edges (4)

  • guide → okhttp (coupling)
  • mockwebserver → okhttp (coupling)
  • okhttp-brotli → okhttp (coupling)
  • okhttp-zstd → okhttp (coupling)

Removed dependency edges (was a dependency, now gone) (4)

  • guide → okhttp
  • mockwebserver → okhttp
  • okhttp-brotli → okhttp
  • okhttp-zstd → okhttp

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

square/okhttp was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 23 October 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit c3179301fc7d0266c5bf154870c2b0b9da01e7e7 — the exact code this score is about.
  • Scored under rubric-2026.10.5 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer measure-2026.10.6+preprod-d36780c2d857.