From: Christopher Faulet Date: Tue, 15 Sep 2026 12:00:23 +0000 (+0200) Subject: MEDIUM: mux-h2: Use RAW_DATA blocks to store tunneled data X-Git-Tag: v3.5-dev8~144 X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=523112b72;p=haproxy.git MEDIUM: mux-h2: Use RAW_DATA blocks to store tunneled data For a tunneled H2 stream, the end of the HTTP message is reported just after the headers, when H2_SF_BODY_TUNNEL flag is set. So any DATA frame received after that carries tunneled data and must be stored in a RAW_DATA block. h2_frt_transfer_data() was updated accordingly. Thanks to this change, HTTP data and tunneled data are no longer mixed on the H2 side. The early end of the message is thus preserved when tunneled data are received, and the next commit is able to remove the workaround that was necessary to keep both in separate buffers. --- diff --git a/src/mux_h2.c b/src/mux_h2.c index 45284923b..d08cb6eff 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -6619,7 +6619,14 @@ try_again: if (flen > block) flen = block; - sent = htx_add_data(htx, ist2(b_head(&h2c->dbuf), flen)); + /* Tunneled data must never be mixed with HTTP data. A dedicated block + * type is used for them. This way, the end of the HTTP message, reported + * just after the headers for a tunneled stream, is preserved. + */ + if (h2s->flags & H2_SF_BODY_TUNNEL) + sent = htx_add_raw_data(htx, ist2(b_head(&h2c->dbuf), flen)); + else + sent = htx_add_data(htx, ist2(b_head(&h2c->dbuf), flen)); TRACE_DATA("move some data to h2s rxbuf", H2_EV_RX_FRAME|H2_EV_RX_DATA, h2c->conn, h2s, 0, (void *)(long)sent); b_del(&h2c->dbuf, sent);