]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
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)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 17 Apr 2025 12:49:36 +0000 (14:49 +0200)
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.

src/mux_h2.c

index c0dc7c393842081e53807ebbe3444fd094757007..1de8cb2637ccedec35a1fc7d614c7044ab0ab4f3 100644 (file)
@@ -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))