From: Christopher Faulet Date: Tue, 15 Sep 2026 12:00:43 +0000 (+0200) Subject: Revert "MEDIUM: mux-h2: Don't mix HTTP and tunneled data in the same buffer" X-Git-Tag: v3.5-dev8~143 X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=8912b826186b29ae26fdc0aa33055581d7d9abf2;p=haproxy.git Revert "MEDIUM: mux-h2: Don't mix HTTP and tunneled data in the same buffer" This reverts commit b6433eb62 (the rename of htx_has_eom() into htx_msg_ended() was taken into account). Because the end of the message is carried by the tail block of the HTX message, HTTP data and tunneled data could not be stored in the same buffer. Adding tunneled data after the block carrying the EOM flag would have hidden the end of the message. So the H2 multiplexer had to store them in a separate buffer and to delay their transfer to the upper layer until the HTTP part was fully consumed. Tunneled data are now stored in RAW_DATA blocks. They can no longer be confused with HTTP data and htx_msg_ended() is able to report the end of the message when the tail block is such block. So this workaround is no longer necessary. The original behavior is restored: only one rxbuf is used and the transfer of the tunneled data is no longer delayed. --- diff --git a/src/mux_h2.c b/src/mux_h2.c index d08cb6eff..00272fd03 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -983,15 +983,6 @@ static inline int h2s_may_append_to_rxbuf(const struct h2s *h2s) return 0; htx = htxbuf(rxbuf); - - /* Nothing must be added in a message already ended. For a tunneled - * stream, the end of the HTTP message is reported just after the - * headers. So tunneled data must be stored in a separate buffer to - * never mix HTTP data and tunneled data. - */ - if (htx_msg_ended(htx)) - return 0; - return !!htx_free_data_space(htx); } @@ -8071,21 +8062,8 @@ static size_t h2_rcv_buf(struct stconn *sc, struct buffer *buf, size_t count, in htx_to_buf(h2s_htx, rxbuf); goto end; } - buf_htx = htx_from_buf(buf); - - /* Nothing must be added in a message already ended. For a tunneled - * stream, the end of the HTTP message is reported just after the - * headers while tunneled data are stored in a separate buffer. So - * these data must be transferred only once the upper layer has - * consumed the HTTP part. - */ - if (htx_msg_ended(buf_htx)) { - htx_to_buf(buf_htx, buf); - htx_to_buf(h2s_htx, rxbuf); - goto end; - } - ret += h2s_htx->data; + buf_htx = htx_from_buf(buf); /* is empty and the message is small enough, swap the * buffers. */