From: Willy Tarreau Date: Thu, 21 Oct 2021 15:30:06 +0000 (+0200) Subject: BUG/MINOR: mux-h2: do not prevent from sending a final GOAWAY frame X-Git-Tag: v2.5-dev11~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e6dc7a0129b8b34e7e1ce1f4bda5d4bfee4ab749;p=thirdparty%2Fhaproxy.git BUG/MINOR: mux-h2: do not prevent from sending a final GOAWAY frame Some checks were added by commit 9a3d3fcb5 ("BUG/MAJOR: mux-h2: Don't try to send data if we know it is no longer possible") to make sure we don't loop forever trying to send data that cannot leave. But one of the conditions there is not correct, the one relying on H2_CS_ERROR2. Indeed, this state indicates that the error code was serialized into the mux buffer, and since the test is placed before trying to send the data to the socket, if the connection states only contains a GOAWAY frame, it may refrain from sending and may close without sending anything. It's not dramatic, as GOAWAY reports connection errors in situations where delivery is not even certain, but it's cleaner to make sure the error is properly sent, and it avoids upsetting h2spec, as seen in github issue #1422. Given that the patch above was backported as far as 1.8, this patch will also have to be backported that far. Thanks to Ilya for reporting this one. --- diff --git a/src/mux_h2.c b/src/mux_h2.c index 03dbd54a10..aeaa86cae1 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -3771,7 +3771,7 @@ static int h2_send(struct h2c *h2c) done = 1; // we won't go further without extra buffers if ((conn->flags & (CO_FL_SOCK_WR_SH|CO_FL_ERROR)) || - (h2c->st0 == H2_CS_ERROR2) || (h2c->flags & H2_CF_GOAWAY_FAILED)) + (h2c->flags & H2_CF_GOAWAY_FAILED)) break; if (h2c->flags & (H2_CF_MUX_MFULL | H2_CF_DEM_MBUSY | H2_CF_DEM_MROOM))