From: Willy Tarreau Date: Thu, 3 Jan 2019 09:26:23 +0000 (+0100) Subject: BUG/MINOR: mux-h2: only update rxbuf's length for H1 headers X-Git-Tag: v2.0-dev1~295 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=831959300578212721f573fb3656768806675422;p=thirdparty%2Fhaproxy.git 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 1b240a942b..af7af061ff 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -3344,6 +3344,8 @@ next_frame: } 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 @@ next_frame: 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);