unstale

pypi / httpx2

httpx2

What changed in httpx2 2, from its official release notes, upgrade guides and advisories. Also covers httpcore2. Sources checked 2026-11-30.

14 breaking7 security2 deprecations17 new APIs and options5 performance7 behavior and defaults2 tooling30 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

httpx2 284 changes

Breaking changes 14

  • *.example.com now matches subdomains, behaving like .example.com, so those requests no longer go through the proxy.

    2.16.1release notes

  • Cookies from different domains are sent from the least to the most specific domain; cookies with longer paths still come first.

    2.16.0release notes

  • Python 3.10 is no longer supported; developers must use Python 3.11 or later.

    2.15.0release notes

  • HTTP/1.1 is no longer advertised during TLS protocol negotiation when it is disabled.

    2.13.1release notes

  • HTTP/2 is preferred during TLS protocol negotiation when enabled.

    2.13.1release notes

  • The brotli extra on non-CPython implementations now requires brotlicffi 1.2.0.2 or later.

    2.13.0release notes

  • The trio extra now requires Trio 0.34.0 or later.

    2.13.0release notes

  • The brotli extra now requires Brotli 1.2.0 or later.

    2.11.0release notes

  • Enforces the WebSocket maximum message size across fragments.

    2.10.0release notes

  • Raises when verify is a string and cert is provided.

    2.3.0release notes

  • Python 3.9 is no longer supported.

    2.1.0release notes

  • GoogleGLAProvider moves from the pydantic_ai.providers.google module to pydantic_ai.providers.google_gla.

    2.0.0upgrade guide

  • GoogleVertexProvider moves from the pydantic_ai.providers.google module to pydantic_ai.providers.google_vertex.

    2.0.0upgrade guide

  • Importing common removed names raises an ImportError that names the replacement and links the migration map. hasattr() and getattr() raise the same error, so cross-version code should detect versions with try/except ImportError.

    2.0.0upgrade guide

Security 7

Deprecations 2

  • Uses a custom deprecation warning that is visible by default.

    2.4.0release notes

  • Calling result.usage() remains supported with a deprecation warning until V3; result.usage is a property.

    2.0.0upgrade guide

New APIs and options 17

  • Adds an immutable, hashable value object for comparing normalized origins without URL paths, queries, fragments, or credentials.

    2.11.0release notes

  • Adds a property that exposes a URL's normalized origin.

    2.11.0release notes

  • Adds status code constants from RFC 9110.

    2.10.0release notes

  • httpx2 now runs on Pyodide / Emscripten using a JavaScript fetch-based transport.

    2.10.0release notes

  • Adds alias_httpx() to alias httpx imports to httpx2.

    2.9.0release notes

  • Native WebSocket support lets clients open WebSocket connections and send and receive messages.

    2.6.0release notes

  • Adds support for the QUERY method (RFC 10008).

    2.6.0release notes

  • Adds native server-sent events support through client.sse().

    2.5.0release notes

  • Headers now supports the | operator.

    2.5.0release notes

  • Headers now supports the |= operator.

    2.5.0release notes

  • Agent accepts output_retries=N to configure the output retry budget.

    2.0.0upgrade guide

  • Agent accepts retries as a mapping with output and tools budgets; a bare integer sets both budgets.

    2.0.0upgrade guide

  • Agent specs accept output_retries and tool_retries settings.

    2.0.0upgrade guide

  • Agent accepts tool_retries=N to configure the tool retry budget.

    2.0.0upgrade guide

  • The retries configuration accepts an integer or a mapping with output and tools keys.

    2.0.0upgrade guide

  • run(), run_sync(), run_stream(), iter(), and override() accept output_retries=N.

    2.0.0upgrade guide

  • run(), run_sync(), run_stream(), iter(), and override() accept retries as a mapping with an output budget.

    2.0.0upgrade guide

Performance 5

  • Building the header looks up only domains matching the request host and skips expired-cookie sweeps until a cookie is due; with 1,000 cookies across 500 domains, it is about 18 times faster.

    2.16.0release notes

  • On Linux, the default SSL context is configured once instead of on every handshake, preventing CPU usage per request from growing over the lifetime of a reused client with OpenSSL older than 3.4.

    2.15.1release notes

  • Cookie extraction is skipped when a response has no Set-Cookie header, making typical requests roughly 8% faster.

    2.10.0release notes

  • Sending large HTTP/2 request bodies no longer copies the body quadratically, reducing the time to send a 256 MiB body from about 36 seconds to under 0.1 seconds.

    2.10.0release notes

  • SSE chunk buffering is faster, with parsing up to 35 times faster on highly fragmented streams.

    2.10.0release notes

Behavior and default changes 7

  • The client reuses its cookie jar instead of copying it on every request and redirect, so a custom policy set on the jar now applies to outgoing requests.

    2.16.0release notes

  • Entries can match IP CIDR ranges and bracketed IPv6 addresses; requests to addresses in a CIDR range bypass the proxy.

    2.14.0release notes

  • alias_httpx() aliases httpcore imports to httpcore2.

    2.9.1release notes

  • IPv6 CIDR notation is now allowed in no_proxy.

    2.5.0release notes

  • A callable supplied for default_encoding may now return None.

    2.3.0release notes

  • Default SSL verification switches from certifi to truststore.

    2.3.0release notes

  • httpcore2 switches from certifi to truststore for default SSL verification.

    2.3.0release notes

Tooling 2

Fixes and other changes 30

  • The URLTypes, QueryParamTypes, HeaderTypes, CookieTypes, TimeoutTypes, ProxyTypes and AuthTypes aliases are Union objects again, so runtime typing constructs such as Optional[...] and | None work.

    2.16.2release notes

  • Digest challenges with mixed-case parameter names are accepted, and whitespace around = is allowed.

    2.16.1release notes

  • An HTTP/2 request sent directly to an httpcore2 connection without a Host header raises LocalProtocolError instead of IndexError.

    2.16.1release notes

  • Concurrent uploads sharing an HTTP/2 connection finish instead of hanging until the read timeout after flow control updates.

    2.16.1release notes

  • When redirects are not followed, an invalid Location returns the response with its headers, and response.next_request is None.

    2.16.1release notes

  • When a file is passed as content, Content-Length is calculated from its remaining bytes, respecting its current position.

    2.13.1release notes

  • The sni_hostname extension is honored for TLS inside HTTP proxy tunnels without affecting the proxy's TLS connection.

    2.13.1release notes

  • The sync WebSocket keepalive thread exits cleanly when a ping races with connection shutdown.

    2.13.1release notes

  • Avoids nested async generator finalization errors when streamed responses are abandoned early.

    2.13.0release notes

  • The CLI flag now disables TLS certificate verification as intended.

    2.13.0release notes

  • Response streams are now closed when decoding fails.

    2.12.0release notes

  • Restores availability of deprecated status code aliases.

    2.11.0release notes

  • Buffered request body lengths are exposed to WSGI applications.

    2.11.0release notes

  • Propagates the original exception instead of raising KeyError when an HTTP/2 stream fails.

    2.10.0release notes

  • Unsolicited and duplicate Pong frames are ignored.

    2.10.0release notes

  • Adds support for Python 3.15.

    2.10.0release notes

  • Cleans up garbage connections when cancellation occurs in AsyncConnectionPool.

    2.6.0release notes

  • Empty SSE keepalive events are suppressed.

    2.5.0release notes

  • SSE content type is now accepted case-insensitively.

    2.5.0release notes

  • Timeouts are now propagated through the SOCKS5 handshake.

    2.5.0release notes

  • An empty Digest auth realm no longer causes a crash.

    2.4.0release notes

  • Moves stream events cleanup inside the state lock.

    2.4.0release notes

  • Decodes IDNA labels in non-leading host positions.

    2.4.0release notes

  • Releases the HTTP/2 semaphore permit when this error occurs.

    2.4.0release notes

  • Uses an RLock instead of a Lock to prevent thread deadlocks.

    2.4.0release notes

  • The zstd import is optional on Python 3.14.

    2.3.0release notes

  • Handles multi-frame zstd streams split across chunks, so these streams can be decoded correctly.

    2.2.0release notes

  • Streams now wait for positive HTTP/2 flow-control credit when the stream window goes negative.

    2.1.0release notes

  • Python 3.14 is now supported.

    2.1.0release notes

  • The release is fully compatible with the latest httpx.

    2.0.0release notes