From: Amaury Denoyelle Date: Thu, 10 Apr 2025 15:41:39 +0000 (+0200) Subject: BUG/MINOR: rhttp: ensure GOAWAY can be emitted after reversal X-Git-Tag: v3.2-dev11~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e6f8ce3282fc5461e30adae3c76cbceb2bc327e;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/mux_h2.c b/src/mux_h2.c index c0dc7c393..1de8cb263 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -3997,6 +3997,8 @@ static int h2_conn_reverse(struct h2c *h2c) struct proxy *prx = l->bind_conf->frontend; h2c->flags &= ~H2_CF_IS_BACK; + /* Must manually init max_id so that GOAWAY can be emitted. */ + h2c->max_id = 0; h2c->shut_timeout = h2c->timeout = prx->timeout.client; if (tick_isset(prx->timeout.clientfin))