Skip to content

Releases

v2.16.2

Choose a tag to compare

@Kludex Kludex released this 16 Nov 10:08
781ea16

🩹 Type aliases evaluate at runtime again

httpx2 and httpcore2 2.16.2 are a patch release with one fix. You will notice it if your code, or a library you depend on, uses the aliases in httpx2._types inside a runtime typing construct. On 2.16.1, import mistralai.client failed on Python 3.11 to 3.13.

pip install --upgrade httpx2==2.16.2
  • Optional[QueryParamTypes] and QueryParamTypes | None work again (#1346). In 2.16.1 URLTypes, QueryParamTypes, HeaderTypes, CookieTypes, TimeoutTypes, ProxyTypes and AuthTypes were strings. Optional[...] raised SyntaxError for QueryParamTypes and HeaderTypes, and | None raised TypeError for all seven. They are Union[...] objects again, as in 2.16.0.

httpcore2 has no changes. It is bumped to stay in lockstep with httpx2.

Full changelog: v2.16.1...v2.16.2

v2.16.1

Choose a tag to compare

@Kludex Kludex released this 16 Nov 08:50
c522907

🚦 Concurrent HTTP/2 uploads no longer stall

httpx2 and httpcore2 2.16.1 are a patch release. Every change is a fix. You will notice it most if you run several HTTP/2 uploads over one connection, where requests could hang until the read timeout.

pip install --upgrade httpx2==2.16.1
  • Uploads sharing an HTTP/2 connection finish instead of waiting for the read timeout (#1163). Once the flow control window was exhausted, a waiting upload could miss the WINDOW_UPDATE that another task had already read, then block on a read the server had nothing to answer. httpcore2 now rechecks the window after acquiring the read lock.
  • A missing Host header raises LocalProtocolError (#1319). An HTTP/2 request sent directly to an httpcore2 connection without Host raised IndexError before.

🧭 Redirects, proxies and Digest auth

  • A redirect with an invalid Location returns the response when redirects are not followed (#1064). httpx2 raised RemoteProtocolError and discarded the response. You now get the response with its headers, and response.next_request is None.
  • *.example.com in NO_PROXY matches subdomains (#1277). The entry never matched before, so those requests still went through the proxy. It now behaves like .example.com.
  • Digest challenges with mixed-case parameter names are accepted (#1315). A challenge such as Digest Realm="r", Nonce="n" raised ProtocolError before. Whitespace around = is allowed too.

📦 Signed releases

  • The publish workflow generates PEP 740 attestations (#1339). Every distribution is signed before uv publish uploads it. Releases since the move to uv publish had no provenance on PyPI.

Full changelog: v2.16.0...v2.16.1

v2.16.0

Choose a tag to compare

@Kludex Kludex released this 21 Oct 07:09
6bfbf29

Highlights

🍪 Faster requests with large cookie jars

Building the Cookie header no longer scans every cookie in the jar. The client reuses its jar instead of copying it on every request and redirect (#1284), only looks up the domains that can match the request host, and skips the expired cookie sweep until a cookie is due (#1285). With 1,000 cookies across 500 domains, building the Cookie header is about 18 times faster.

Cookies from different domains are now sent from the least to the most specific domain, for example .example.org before sub.example.org, instead of in the order the domains were added. Cookies with longer paths still come first.

httpx2

Changed

  • Look up only the cookie domains that match the request host, and skip the expired cookie sweep until a cookie is due. With 1,000 cookies across 500 domains, building the Cookie header is about 18 times faster. Cookies from different domains are now sent from the least to the most specific domain (#1285).

Fixed

  • Reuse the client cookie jar instead of copying it on every request and redirect. A custom policy set with client.cookies.jar.set_policy() now applies to outgoing requests (#1284).

httpcore2

No changes since 2.15.1. Version bumped to stay in lockstep with httpx2.

Full Changelog: v2.15.1...v2.16.0

v2.15.1

Choose a tag to compare

@Kludex Kludex released this 19 Oct 20:13
6dd59b9

Highlights

🔒 Flat CPU usage for long-lived clients on Linux

On Linux, the default SSL context is now configured once instead of on every handshake (#1253). With OpenSSL older than 3.4, each handshake added a duplicate certificate lookup path, so CPU usage per request grew over the lifetime of a reused client. Certificate verification is unchanged, and Windows and macOS still use truststore.

httpx2

Fixed

  • Configure the default SSL context once on Linux, instead of on every handshake. With OpenSSL older than 3.4, CPU usage grew over the lifetime of a reused client (#1253).

httpcore2

Fixed

  • Configure the default SSL context once on Linux, instead of on every handshake. With OpenSSL older than 3.4, CPU usage grew over the lifetime of a reused client (#1253).

Full Changelog: v2.15.0...v2.15.1

v2.15.0

Choose a tag to compare

@Kludex Kludex released this 19 Oct 20:08
6078596

Highlights

🐍 Python 3.11+ required

httpx2 and httpcore2 no longer support Python 3.10 (#1274). There are no other changes in this release.

httpx2

Removed

  • Drop support for Python 3.10 (#1274).

httpcore2

Removed

  • Drop support for Python 3.10 (#1274).

Full Changelog: v2.14.0...v2.15.0

v2.14.0

Choose a tag to compare

@Kludex Kludex released this 18 Oct 16:28
4fa853a

Highlights

🌐 CIDR ranges in NO_PROXY

NO_PROXY and mounts now match IP CIDR ranges like 192.168.0.0/16 and [fe80::]/10, so any address in the range bypasses the proxy (#1165). Bracketed IPv6 addresses like [::1]:8080 are accepted, and unparseable NO_PROXY entries are ignored instead of failing client creation (#1267).

🔐 FIPS-enforced Python support

httpx2 now imports on FIPS-enforced Python builds without hashlib.md5. DigestAuth raises ProtocolError only when the server asks for an unavailable algorithm (#1130).

🔌 Sturdier connections and WebSocket shutdown

HTTP/2 reads no longer block when a server lowers SETTINGS_MAX_CONCURRENT_STREAMS mid-flight (#1217), and writing after a peer closes TLS without close_notify raises WriteError (#1263). Sync WebSocket sessions no longer hang on exit with a full event queue (#1123), and ASGI WebSocket reads after app shutdown no longer leak anyio exceptions (#1233).

httpx2

Added

  • Match IP CIDR ranges, like 192.168.0.0/16 and [fe80::]/10, in NO_PROXY and mounts. Requests to any address in the range now bypass the proxy; previously only the network address itself did (#1165).
  • Accept bracketed IPv6 addresses, like [::1] and [::1]:8080, in NO_PROXY (#1267).

Changed

  • Raise InvalidURL for a mounts key with an IP host followed by anything other than a valid CIDR prefix, like all://10.0.0.0/33 (#1165).

Fixed

  • Ignore NO_PROXY entries that cannot be parsed, instead of raising InvalidURL when the client is created (#1267).
  • Import httpx2 on FIPS-enforced Python builds without hashlib.md5. DigestAuth raises ProtocolError when the server asks for an unavailable algorithm (#1130).
  • Handle reads after an ASGI WebSocket app shuts down, instead of leaking anyio exceptions (#1233).
  • Stop the sync WebSocket session from hanging on exit when its event queue is full (#1123).

httpcore2

Fixed

  • Keep CONNECT and absolute-form proxy targets when the request sets the target extension (#1262).
  • Stop blocking reads when an HTTP/2 server lowers SETTINGS_MAX_CONCURRENT_STREAMS while requests are in flight (#1217).
  • Raise WriteError instead of anyio.EndOfStream when writing after the peer closes a TLS connection without close_notify (#1263).

Full Changelog: v2.13.1...v2.14.0

v2.13.1

Choose a tag to compare

@Kludex Kludex released this 23 Sep 07:46
d91c9f4

Highlights

📤 Accurate file upload lengths

Passing a file as content= now calculates Content-Length from its remaining bytes, respecting the current file position (#1214).

🔐 Reliable proxy TLS and HTTP/2 negotiation

TLS hostname overrides now apply inside HTTP proxy tunnels without affecting the proxy's own TLS connection (#1223). HTTP/2 is advertised first when enabled, and HTTP/1.1 is omitted when disabled (#1155).

🧹 Clean WebSocket shutdown

The sync WebSocket keepalive thread now exits cleanly when a ping races with connection shutdown (#1228).

httpx2

Fixed

  • Calculate Content-Length from the remaining bytes when a file is passed as content=, respecting its current position (#1214).
  • Stop the sync WebSocket keepalive thread cleanly when a ping races with connection shutdown (#1228).

httpcore2

Fixed

  • Honor the sni_hostname extension for TLS inside HTTP proxy tunnels without applying it to the proxy's TLS connection (#1223).
  • Prefer HTTP/2 during TLS protocol negotiation when enabled, and stop advertising HTTP/1.1 when it is disabled (#1155).

Full Changelog: v2.13.0...v2.13.1

v2.13.0

Choose a tag to compare

@Kludex Kludex released this 14 Sep 14:17
f295185

Highlights

🔐 Reliable TLS verification controls

The CLI --no-verify flag now disables TLS certificate verification as intended, and --verify provides an explicit counterpart (#1140, #1186).

🧹 Safer async stream cleanup

Stopping a streamed response early no longer risks a nested async generator finalization error (#1204).

httpx2

Changed

  • Require brotlicffi 1.2.0.2 or later for the brotli extra on non-CPython implementations in #1179

Fixed

  • Make the --no-verify CLI flag disable TLS certificate verification and add an explicit --verify counterpart in #1140 and #1186
  • Avoid nested async generator finalization errors when streamed responses are abandoned early in #1204

httpcore2

Changed

  • Require Trio 0.34.0 or later for the trio extra in #1179

Fixed

  • Avoid nested async generator finalization errors when streamed responses are abandoned early in #1204

Full Changelog: v2.12.0...v2.13.0

v2.12.0

Choose a tag to compare

@Kludex Kludex released this 18 Aug 13:21
71ae23b

Highlights

🛡️ Bounded response decompression

httpx2 now decodes gzip, deflate, Brotli, and Zstandard responses incrementally. Each decode step emits at most 1 MiB, so streaming a highly compressed response no longer requires materializing an entire inflated network chunk in memory (#1126).

📦 Shared Zstandard API

Python 3.13 and earlier now use backports.zstd, which provides the same bounded incremental decompression API as compression.zstd on Python 3.14 and later (#1146).

httpx2

Changed

  • Use backports.zstd for Zstandard decoding on Python 3.13 and earlier by @Kludex in #1146

Fixed

  • Bound peak memory while streaming compressed responses and close response streams when decoding fails by @Kludex in #1126

httpcore2

No changes since 2.11.0. Version bumped to stay in lockstep with httpx2.

Full Changelog: v2.11.0...v2.12.0

v2.11.0

Choose a tag to compare

@Kludex Kludex released this 18 Aug 08:03
2b13fa9

Highlights

🌐 Public origin API

httpx2 now includes an immutable and hashable Origin value object, available through URL.origin. It provides normalized scheme, host, and effective port comparisons without including URL paths, queries, fragments, or credentials (#1134).

🛠️ Request compatibility and validation

  • Explicit Transfer-Encoding headers now take precedence over body-derived Content-Length headers (#1137).
  • Deprecated status code aliases are available again (#1135).
  • Multipart part headers are validated before serialization (#1142).

httpx2

Added

  • Add the public Origin value object and URL.origin property by @Kludex in #1134

Changed

  • Require Brotli 1.2.0 or later for the brotli extra by @Kludex in #1141

Fixed

  • Restore deprecated status code aliases by @Kludex in #1135
  • Extract HTTP/2 release notes from changelog headings correctly by @Kludex in #1136
  • Respect explicit Transfer-Encoding headers and expose buffered request body lengths to WSGI applications by @Kludex in #1137
  • Validate multipart part header names and values before serialization by @Kludex in #1142

httpcore2

Changed

  • Cache sniffio availability instead of importing it on every synchronization call by @mbeijen in #1132

Full Changelog: v2.10.0...v2.11.0