]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: mux-h1: only accept the H2 preface on the first request
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 7 Oct 2026 09:53:15 +0000 (11:53 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 12 Oct 2026 13:46:18 +0000 (15:46 +0200)
commitcec63e95f62a7412484f1134f5aa227e5b7e1466
tree2189317ee34ac01b05273379b0e068130ff08f67
parent97109ffe57831c8912c12ea7e4a5a5d8a55099da
BUG/MEDIUM: mux-h1: only accept the H2 preface on the first request

The H1 to H2 upgrade via the H2 connection preface is only supported for the
first request of a connection. It is checked by testing the absence of
H1C_F_WAIT_NEXT_REQ, which is set on the H1 connection once a first
transaction is finished. But this flag is moved to the H1 stream
(H1S_F_NOT_FIRST) and removed from the connection as soon as a new H1 stream
is created, which happens when the beginning of the next request is
received. So when the preface of a second request is received in several
parts (e.g. "PRI " then the rest), the first part creates an embryonic H1
stream and clears the flag, and the upgrade is then accepted when the
complete preface is received. The connection is upgraded to H2 in the middle
of its life, while the end of the previous response may still be pending in
the output buffer (it is then lost).

Now the H1 stream's H1S_F_NOT_FIRST flag is also checked.

This was introduced by commit 39c7b6b09 ("MEDIUM: mux-h1: Add ST_READY
state for the H1 connections") in 2.4. It may be backported to all
stable versions.
src/mux_h1.c