]> git.kaiwu.me - haproxy.git/commit
MINOR: h1: preserve version and method flags when restarting on output_full
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 1 Dec 2026 14:31:07 +0000 (15:31 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 3 Dec 2026 12:41:06 +0000 (13:41 +0100)
commit2cd436ff576aa816c5d1d2cb928bf2d850e59813
treee56e7a18180161ce153f7bb2c6a340bf95260a15
parentb9ebe1dc5c389735409ae2a848a8b1abe3f4171b
MINOR: h1: preserve version and method flags when restarting on output_full

When the conversion of the parsed headers into HTX does not fit in the
destination, h1_postparse_req_hdrs() and h1_postparse_res_hdrs() reset the
message parser state to restart the parsing once the destination was
drained. But the reset dropped some flags not derived from the message
itself: on the response side, the HEAD or CONNECT method flags set by the
mux from the request, and the version flag, which is only set by the mux
for a response without start line (FCGI). On the next parsing they would
not be set again: for a FCGI response, the version is never re-derived
from the message, so the synthesized start line could get the wrong HTTP
version, and a response to a HEAD request could be framed with a body.
On the request side, the version flag is preserved too, for consistency.

This cannot be triggered today: the reset is only reachable on the H1 side,
where the mux sets the method flags again before each parsing attempt and
the parser sets the version flag from the start line, and a FCGI response
cannot hit output_full (there is only one response per stream, so the
destination HTX is empty when its headers are parsed, and a too large
message takes the error path instead). This is a hardening aligning the
reset with the restart convention of h1_headers_to_hdr_list()
(H1_MF_RESTART_MASK plus H1_MF_VER_11).
src/h1_htx.c