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 inithttpx2 284 changes
Breaking changes 14
*.example.com now matches subdomains, behaving like .example.com, so those requests no longer go through the proxy.
Cookies from different domains are sent from the least to the most specific domain; cookies with longer paths still come first.
Python 3.10 is no longer supported; developers must use Python 3.11 or later.
HTTP/1.1 is no longer advertised during TLS protocol negotiation when it is disabled.
HTTP/2 is preferred during TLS protocol negotiation when enabled.
The brotli extra on non-CPython implementations now requires brotlicffi 1.2.0.2 or later.
The trio extra now requires Trio 0.34.0 or later.
The
brotliextra now requires Brotli 1.2.0 or later.Enforces the WebSocket maximum message size across fragments.
Raises when verify is a string and cert is provided.
Python 3.9 is no longer supported.
GoogleGLAProvider moves from the pydantic_ai.providers.google module to pydantic_ai.providers.google_gla.
GoogleVertexProvider moves from the pydantic_ai.providers.google module to pydantic_ai.providers.google_vertex.
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.
Security 7
Adds an explicit CLI counterpart for enabling TLS certificate verification.
gzip, deflate, Brotli, and Zstandard responses are decoded incrementally, emitting at most 1 MiB per decode step to limit memory use when streaming highly compressed responses.
Validates multipart part header names and values before serialization.
Explicit
Transfer-Encodingheaders take precedence over body-derivedContent-Lengthheaders.HTTPX2: Secure WebSocket traffic sent without TLS through SOCKS proxies
Adds an option to cap SSE event buffering.
Limits chained Content-Encoding decoders to 5.
Deprecations 2
Uses a custom deprecation warning that is visible by default.
Calling result.usage() remains supported with a deprecation warning until V3; result.usage is a property.
New APIs and options 17
Adds an immutable, hashable value object for comparing normalized origins without URL paths, queries, fragments, or credentials.
Adds a property that exposes a URL's normalized origin.
Adds status code constants from RFC 9110.
httpx2 now runs on Pyodide / Emscripten using a JavaScript fetch-based transport.
Adds alias_httpx() to alias httpx imports to httpx2.
Native WebSocket support lets clients open WebSocket connections and send and receive messages.
Adds support for the QUERY method (RFC 10008).
Adds native server-sent events support through client.sse().
Headers now supports the | operator.
Headers now supports the |= operator.
Agent accepts output_retries=N to configure the output retry budget.
Agent accepts retries as a mapping with output and tools budgets; a bare integer sets both budgets.
Agent specs accept output_retries and tool_retries settings.
Agent accepts tool_retries=N to configure the tool retry budget.
The retries configuration accepts an integer or a mapping with output and tools keys.
run(), run_sync(), run_stream(), iter(), and override() accept output_retries=N.
run(), run_sync(), run_stream(), iter(), and override() accept retries as a mapping with an output budget.
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.
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.
Cookie extraction is skipped when a response has no Set-Cookie header, making typical requests roughly 8% faster.
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.
SSE chunk buffering is faster, with parsing up to 35 times faster on highly fragmented streams.
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.
Entries can match IP CIDR ranges and bracketed IPv6 addresses; requests to addresses in a CIDR range bypass the proxy.
alias_httpx() aliases httpcore imports to httpcore2.
IPv6 CIDR notation is now allowed in no_proxy.
A callable supplied for default_encoding may now return None.
Default SSL verification switches from certifi to truststore.
httpcore2 switches from certifi to truststore for default SSL verification.
Tooling 2
The return type is now
str | Noneinstead ofAny.The cli extra allows version 15 of rich.
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.
Digest challenges with mixed-case parameter names are accepted, and whitespace around = is allowed.
An HTTP/2 request sent directly to an httpcore2 connection without a Host header raises LocalProtocolError instead of IndexError.
Concurrent uploads sharing an HTTP/2 connection finish instead of hanging until the read timeout after flow control updates.
When redirects are not followed, an invalid Location returns the response with its headers, and response.next_request is None.
When a file is passed as content, Content-Length is calculated from its remaining bytes, respecting its current position.
The
sni_hostnameextension is honored for TLS inside HTTP proxy tunnels without affecting the proxy's TLS connection.The sync WebSocket keepalive thread exits cleanly when a ping races with connection shutdown.
Avoids nested async generator finalization errors when streamed responses are abandoned early.
The CLI flag now disables TLS certificate verification as intended.
Response streams are now closed when decoding fails.
Restores availability of deprecated status code aliases.
Buffered request body lengths are exposed to WSGI applications.
Propagates the original exception instead of raising
KeyErrorwhen an HTTP/2 stream fails.Unsolicited and duplicate Pong frames are ignored.
Adds support for Python 3.15.
Cleans up garbage connections when cancellation occurs in AsyncConnectionPool.
Empty SSE keepalive events are suppressed.
SSE content type is now accepted case-insensitively.
Timeouts are now propagated through the SOCKS5 handshake.
An empty Digest auth realm no longer causes a crash.
Moves stream events cleanup inside the state lock.
Decodes IDNA labels in non-leading host positions.
Releases the HTTP/2 semaphore permit when this error occurs.
Uses an RLock instead of a Lock to prevent thread deadlocks.
The zstd import is optional on Python 3.14.
Handles multi-frame zstd streams split across chunks, so these streams can be decoded correctly.
Streams now wait for positive HTTP/2 flow-control credit when the stream window goes negative.
Python 3.14 is now supported.
The release is fully compatible with the latest httpx.