]> git.kaiwu.me - haproxy.git/commitdiff
Revert "MEDIUM: mux-h2: Don't mix HTTP and tunneled data in the same buffer"
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 15 Sep 2026 12:00:43 +0000 (14:00 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 18 Sep 2026 15:05:19 +0000 (17:05 +0200)
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.

src/mux_h2.c

index d08cb6eff600615d12abc4d21ce8ed070b74b190..00272fd034f8f3b062ef4f7148fbdae12f443926 100644 (file)
@@ -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);
 
        /* <buf> is empty and the message is small enough, swap the
         * buffers. */