BUG/MINOR: rhttp: ensure GOAWAY can be emitted after reversal
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 10 Apr 2025 15:41:39 +0000 (17:41 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 22 Apr 2025 09:11:22 +0000 (11:11 +0200)
commit8335b66c306d4f372bcca3e76b8b08dccd5953b6
tree281f3252810035207930ae9c8866b17b26c27ba3
parent8170eac9d91a43399c5b8c0c7156321f8b98b2b2
BUG/MINOR: rhttp: ensure GOAWAY can be emitted after reversal

GOAWAY emission should not be emitted before preface. Thus, max_id field
from h2c acting as a server is initialized to -1, which prevents its
emission until preface is received from the peer. If acting as a client,
max_id is initialized to a valid value on the first h2s emission.

This causes an issue with reverse HTTP on the active side. First, it
starts as a client, so the peer does not emit a preface but instead a
simple SETTINGS frame. As role are switched, max_id is initialized much
later when the first h2s response is emitted. Thus, if the connection
must be terminated before any stream transfer, GOAWAY cannot be emitted.

To fix this, ensure max_id is initialized to 0 on h2_conn_reverse() for
active connect side. Thus, a GOAWAY indicating that no stream has been
handled can be generated.

Note that passive connect side is not impacted, as it max_id is
initialized thanks to preface reception.

This should be backported up to 2.9.

(cherry picked from commit 9e6f8ce3282fc5461e30adae3c76cbceb2bc327e)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit 05509361e55eda929ff11cf245812c8154728c36)
Signed-off-by: Willy Tarreau <w@1wt.eu>
src/mux_h2.c