]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: h1: don't rewrite the Upgrade header when not cleaning headers
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 7 Oct 2026 08:37:52 +0000 (10:37 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 16 Oct 2026 17:07:18 +0000 (19:07 +0200)
commitca17c297d02a119f8f330e3c16083fcccdf6d199
tree5f6d5e3284508068785055035172bc20d7b0aaea
parent298bd3d474f8b4606494452765024fbdd095aabf
BUG/MEDIUM: h1: don't rewrite the Upgrade header when not cleaning headers

Since commit 8dd49dfab ("BUG/MEDIUM: h1: Skip all h2c values from Upgrade
headers during parsing"), h1_parse_upgrade_header() always rewrites the
Upgrade header value in place to remove the "h2c" and "h2" tokens. This is
desired for the H1 mux, which converts the message to HTX, but not for the
other users of h1_headers_to_hdr_list(). In particular, in TCP mode,
smp_prefetch_http() parses the raw request directly in the channel buffer to
evaluate HTTP sample fetches. There, the request bytes are forwarded as-is
to the server, so the client's Upgrade header was modified in flight.

The rewrite is now only performed when H1_MF_CLEAN_CONN_HDR is set, which is
the flag already used to clean the Connection header up and that is set by
the H1 and FCGI muxes. Without this flag, the value is left untouched and
only the H1_MF_UPG_WEBSOCKET/H1_MF_UPG_HDR flags are computed. The flag's
description was updated accordingly.

This must be backported wherever commit 8dd49dfab was backported, so to all
supported versions.
include/haproxy/h1.h
src/h1.c