BUG/MINOR: mux-h2: only update rxbuf's length for H1 headers
In h2c_decode_headers() we update the buffer's length according to the
amount of data produced (outlen). But in case of HTX this outlen value
is not a quantity, just an indicator of success, resulting in the buffer
being added one extra byte and temporarily showing .data > .size, which
is wrong. Fortunately this is overridden when leaving the function by
htx_to_buf() so the impact only exists in step-by-step debugging, but
it definitely needs to be fixed.
This must be backported to 1.9.
diff --git a/src/mux_h2.c b/src/mux_h2.c
index 1b240a9..af7af06 100644
--- a/src/mux_h2.c
+++ b/src/mux_h2.c
@@ -3344,6 +3344,8 @@
} else {
/* HTTP/1 mode */
outlen = h2_make_h1_request(list, b_tail(rxbuf), try, &msgf);
+ if (outlen > 0)
+ b_add(rxbuf, outlen);
}
if (outlen < 0) {
@@ -3363,7 +3365,6 @@
b_del(&h2c->dbuf, h2c->dfl + hole);
hole = 0;
h2c->st0 = H2_CS_FRAME_H;
- b_add(rxbuf, outlen);
if (htx && h2c->dff & H2_F_HEADERS_END_STREAM)
htx_add_endof(htx, HTX_BLK_EOM);