Skip to content

httpclient,httpserver: Let decompress options select individual encodings - #3935

Merged
bdarnell merged 2 commits into
tornadoweb:masterfrom
bdarnell:claude/project-thread-qd0906
Nov 25, 2026
Merged

bdarnell merged 2 commits into
tornadoweb:masterfrom
bdarnell:claude/project-thread-qd0906

Conversation

@bdarnell

Copy link
Copy Markdown
Member

More precise control over compression methods can be useful to mitigate the impact of vulnerabilities such as the Oct 2026 vulnerability in Brotli.

decompress_response may now be a collection of content-coding names
(e.g. {"gzip", "br"}) in addition to a bool. True keeps each client's
existing default (gzip for simple_httpclient; gzip and deflate for
curl_httpclient), and names a client cannot decode are ignored.

curl_httpclient now enforces the set. Once any decoding is enabled,
libcurl decodes whatever Content-Encoding the server names, whether or
not it was requested, so a server could reach libcurl's brotli (or
zstd) decoder even though we only ever asked for gzip and deflate. The
header callback now fails the transfer if the response uses an
encoding that was not enabled, before any body reaches a decoder. This
limits exposure to decoder bugs such as CVE-2026-111497 to applications
that opt in to the affected encoding.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Kx6jxnmXgCEx18zZkgvPd
Mirror the previous change to HTTPRequest.decompress_response on the
server side: HTTPServer's decompress_request (and
HTTP1ConnectionParameters.decompress, which also serves
simple_httpclient) now accepts a collection of content-coding names as
well as a bool. gzip is still the only encoding implemented, so this
only matters for applications that want to say so explicitly, but it
gives future encodings a way to be enabled individually rather than all
at once.

The helper that interprets these options moves to httputil so both
sides share it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Kx6jxnmXgCEx18zZkgvPd
@bdarnell
bdarnell merged commit 4dfd6a5 into tornadoweb:master Nov 25, 2026
23 checks passed
@bdarnell
bdarnell deleted the claude/project-thread-qd0906 branch November 25, 2026 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants