]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: mux-h2: only update rxbuf's length for H1 headers
authorWilly Tarreau <w@1wt.eu>
Thu, 3 Jan 2019 09:26:23 +0000 (10:26 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 3 Jan 2019 09:30:10 +0000 (10:30 +0100)
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.

src/mux_h2.c

index 1b240a942b14cc82e770b1b7a47c54ee32c67221..af7af061ffc2e10b736274396c54937efc0d420d 100644 (file)
@@ -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);