]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: mux-h2: do not prevent from sending a final GOAWAY frame
authorWilly Tarreau <w@1wt.eu>
Thu, 21 Oct 2021 15:30:06 +0000 (17:30 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 21 Oct 2021 15:37:22 +0000 (17:37 +0200)
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.

src/mux_h2.c

index 03dbd54a104b6318c4bb44c36f6081e9dcdb2da1..aeaa86cae112d705d9e61b1282478788c454e57c 100644 (file)
@@ -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))