]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: mux-h1: skip raw data after a rejected CONNECT again
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 3 Dec 2026 08:34:46 +0000 (09:34 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 3 Dec 2026 12:41:06 +0000 (13:41 +0100)
Since the commit e99253b70 ("BUG/MINOR: mux-h1: properly handle NOOP
blocks and track EOM emission"), RAW_DATA blocks found in DONE state on
the backend side are only skipped if the end of the request was sent,
the H1S_F_EOM_SENT flag being set. But this flag was never set for a
CONNECT request. In h1_make_eoh(), the CONNECT case is handled before the
EOM flag is tested, even if the EOH block carries the EOM flag, which is
always the case for a CONNECT request received from an H1 or an H2
client. So when a CONNECT was rejected by the server, early tunnel data
still pending in the request buffer were rejected with a processing
error instead of being silently skipped. It was a regression of the
commit 04456142e ("BUG/MINOR: mux-h1: Discard pending raw data after a
tunnel rejection").

Now, the H1S_F_EOM_SENT flag is set for a CONNECT request when the EOH
block carries the EOM flag.

This patch must be backported to 3.5.

src/mux_h1.c

index d90f8271abcbfff98462cee1c1308965f700e3ae..b803c5eab84d11c57554bfca33d9528321417879 100644 (file)
@@ -3036,8 +3036,13 @@ static size_t h1_make_eoh(struct h1s *h1s, struct h1m *h1m, struct htx *htx, siz
                if (!chunk_memcat(&outbuf, "\r\n", 2))
                        goto full;
                /* a CONNECT request was sent. Output processing is now blocked
-                * waiting the server response.
+                * waiting the server response. The request ends at its headers.
+                * If the EOH block carries the EOM flag, the end of the message
+                * was reached and must be tracked: tunneled data may follow and
+                * must be skipped if the tunnel is rejected.
                 */
+               if (blk->flags & HTX_BLK_FL_EOM)
+                       h1s->flags |= H1S_F_EOM_SENT;
                h1m->state = H1_MSG_DONE;
                h1s->flags |= H1S_F_TX_BLK;
                TRACE_STATE("CONNECT request waiting for tunnel mode", H1_EV_TX_DATA|H1_EV_H1S_BLK, h1c->conn, h1s);