Skip to content

Skip trailer fields after the last chunk, and answer 400 to a bare LF in them - #1950

Merged
uNetworkingAB merged 1 commit into
uNetworking:masterfrom
nigrosimone:chunked-trailer
Oct 2, 2026
Merged

uNetworkingAB merged 1 commit into
uNetworking:masterfrom
nigrosimone:chunked-trailer

Conversation

@nigrosimone

Copy link
Copy Markdown
Contributor

A chunked body with a trailer field gets a 400 (Http11Probe COMP-CHUNKED-TRAILER-VALID, RFC 9112 7.1.2). HttpParser does not pass trailer to ChunkIterator, so after 0\r\n it drops two bytes and parses the rest as a new request.

The fix passes true in the three calls, so the trailer state machine that is already there reads the fields and drops them. Two more lines answer 400 to a bare LF there: without them, 0\r\n\n with a pipelined request after it takes the request as a trailer field and never answers it.

The new test sends a valid trailer and two bare LF cases, each one followed by a GET. It fails without the fix and without the two lines.

With Http11Probe locally COMP-CHUNKED-TRAILER-VALID goes from Fail to Pass and SMUG-CHUNK-LF-TRAILER from Warn to Pass. Five unscored SMUG-TRAILER-* tests go from Pass to Warn: they passed only because every trailer got a 400.

@nigrosimone
nigrosimone marked this pull request as ready for review October 2, 2026 06:08
@uNetworkingAB
uNetworkingAB merged commit fe0b9d3 into uNetworking:master Oct 2, 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.

2 participants