Repository navigation
fix(mux-h1): write no last chunk or trailers after the head of a response without a body - #1766
Merged
Merged
Conversation
FlorentinDUBOIS
force-pushed
the
fix/h1-no-body-response-trailers
branch
from
October 1, 2026 15:45
113c158 to
8d14110
Compare
This was referenced Oct 1, 2026
Merged
A response to HEAD, a 204 or a 304 ends with its header section on HTTP/1.1 (RFC 9112 section 6.3), but when an H2 backend sent its HEADERS without END_STREAM and without content-length, the response was framed as chunked and the end of its stream, a trailer HEADERS frame or an empty DATA frame, was written to an H1 client as a last chunk, the trailer fields and an empty line after the head, read by a keep-alive client as the start of the next response. ConnectionH1::writable now clears the end-of-body framing and drops the trailer block of such a response before writing (RFC 9110 section 6.5.1), and counts a dropped block in h2.trailers_dropped_no_body. Closes #1761 Signed-off-by: Florentin Dubois <[email protected]>
The end-of-body framing and trailer block of a response to HEAD, a 204 or a 304 are cleared for a stream ended by a trailer HEADERS frame or an empty DATA frame. DATA carrying a payload on such a response is still written after the head; name it as a known gap. Refs #1761 Signed-off-by: Florentin Dubois <[email protected]>
FlorentinDUBOIS
force-pushed
the
fix/h1-no-body-response-trailers
branch
from
October 2, 2026 00:01
16511a7 to
7ba9128
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A response to HEAD, a 204 or a 304 ends with its header section on HTTP/1.1 (RFC 9112 §6.3). When an H2 backend sent its HEADERS without END_STREAM and without
content-length, the response was framed as chunked and the end of its stream (a trailer HEADERS frame or an empty DATA frame) was written to an H1 client as a last chunk, the trailer fields and an empty line after the head.ConnectionH1::writablenow clears the end-of-body framing and drops the trailer block of such a response before writing (RFC 9110 §6.5.1), and counts a dropped block in the newh2.trailers_dropped_no_body. A stream ended by a trailer HEADERS frame or an empty DATA frame then writes nothing after the head. Left as is: theTransfer-Encoding: chunkedfield added to such a head, and DATA carrying a payload on such a response, which is still written after the head.Covered by unit tests in
lib/src/protocol/mux/h1.rsand by the e2e testtest_h2_bodiless_response_trailers_keep_h1_client_framing. Documented inlib/src/protocol/mux/LIFECYCLE.md§8.4,doc/configure.mdandCHANGELOG.md.Fixes #1761