]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: http-ana: Don't close server connection on read0 in TUNNEL mode
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 8 Dec 2025 14:07:03 +0000 (15:07 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 8 Dec 2025 14:22:01 +0000 (15:22 +0100)
It is a very old bug (2012), dating from the introduction of the keep-alive
support to HAProxy. When a request is fully received, the SC on backend side
is switched to NOHALF mode. It means that when the read0 is received from
the server, the server connection is immediately closed. It is expected to
do so at the end of a classical request. However, it must not be performed
if the session is switched to the TUNNEL mode (after an HTTP/1 upgrade or a
CONNECT). The client may still have data to send to the server. And closing
brutally the server connection this way will be handled as an error on
client side.

This bug is especially visible when a H2 connection on client side because a
RST_STREAM is emitted and a "SD--" is reported in logs.

Thanks to @chrisstaite

This patch should fix the issue #3205. It must be backported to all stable
versions.

src/http_ana.c

index 11a0d4ad82f7c19f07dc3bd27792cfbdf743c3f7..6296c0ad3790781f2f317fc1b8531277c3a401a5 100644 (file)
@@ -4492,6 +4492,7 @@ static void http_end_request(struct stream *s)
                         */
                        channel_auto_read(&s->req);
                        txn->req.msg_state = HTTP_MSG_TUNNEL;
+                       s->scb->flags &= ~SC_FL_NOHALF;
                        if (txn->rsp.msg_state != HTTP_MSG_TUNNEL)
                                s->res.flags |= CF_WAKE_ONCE;
                }