Skip to content

Accept any transfer-encoding ending in chunked - #1943

Merged
uNetworkingAB merged 2 commits into
uNetworking:masterfrom
cpruijsen:fix/issue-1941
Sep 13, 2026
Merged

Accept any transfer-encoding ending in chunked#1943
uNetworkingAB merged 2 commits into
uNetworking:masterfrom
cpruijsen:fix/issue-1941

Conversation

@cpruijsen

Copy link
Copy Markdown
Contributor

Since v20.70.0 a request whose Transfer-Encoding ends in chunked but is not exactly the string
chunked is refused with 400. HttpParser.h compares the whole header value against the literal,
so gzip, chunked is rejected, and so is Chunked.

Both are valid. RFC 9112 section 6.1 allows a list of transfer codings and requires only that
chunked be the final one, and section 7 makes transfer-coding names case-insensitive. Clients that
compress and then chunk send the list form, so this refuses well-formed requests.

The check now lowercases the value in place and tests that it ends with chunked rather than equals
it, which accepts the list form and any casing while still refusing a value where chunked is absent
or not final. Preceding codings are left to the application, as before: what the parser needs to know
is that the framing is chunked.

Fixes #1941

@uNetworkingAB
uNetworkingAB merged commit 64c31e6 into uNetworking:master Sep 13, 2026
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.

Transfer-Encoding with chunked as the last coding is refused with 400 since v20.70.0

2 participants