Skip to content

v2.18.0

Latest

Choose a tag to compare

@Kludex Kludex released this 04 Dec 10:52
Immutable release. Only release title and notes can be modified.
9e06d74

🛡️ Safer defaults for streaming, redirects, and TLS

httpx2 and httpcore2 2.18.0 are a minor release. It adds a default per-line cap to iter_lines() and aiter_lines(), strips Proxy-Authorization across origin redirects, reassembles fragmented WebSocket messages in linear time, tightens the default Linux SSL verification flags, and exports AutoBackend from httpcore2.

pip install --upgrade httpx2==2.18.0
  • Line streaming caps single-line length by default (#1391). Response.iter_lines() and Response.aiter_lines() now limit a single buffered line to 1,048,576 characters by default, raising DecodingError and closing the response stream if exceeded. If you stream responses with longer single lines, pass max_line_length=<limit> or max_line_length=None to disable the cap.
  • Proxy-Authorization is stripped on cross-origin redirects (#1389). BaseClient._redirect_headers() now drops caller-supplied Proxy-Authorization headers whenever a redirect changes origin, including same-host HTTP-to-HTTPS upgrades.
  • Default Linux SSL contexts match Python 3.13+ verify flags (#1393). httpcore2.default_ssl_context() now sets ssl.VERIFY_X509_PARTIAL_CHAIN and ssl.VERIFY_X509_STRICT on Linux, matching ssl.create_default_context() on Python 3.13 and newer.

⚡ WebSockets and backends

  • Fragmented WebSocket messages reassemble with one join (#1272, #1392). Both WebSocketSession and AsyncWebSocketSession now collect continuation frames in a list (ignoring empty fragments) and join them once when the final frame arrives, avoiding quadratic copying on multi-frame messages.
  • AutoBackend is exported from httpcore2 (#1390). You can now import AutoBackend directly from the top-level httpcore2 package.

Full changelog: v2.17.2...v2.18.0