]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: htx: When performing zero-copy, start from the right offset.
authorOlivier Houchard <ohouchard@haproxy.com>
Fri, 14 Dec 2018 15:28:08 +0000 (16:28 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 14 Dec 2018 16:02:11 +0000 (17:02 +0100)
When using zerocopy, start from the beginning of the data, not from the
beginning of the buffer, it may have contained headers, and so the data
won't start at the beginning of the buffer.

src/mux_h1.c
src/mux_h2.c

index a20e29a32a5676c2d7c2643000ca5108d03bdcf9..32004c68c4f604bcf3ef5913bd5b226db8c4f2de 100644 (file)
@@ -1404,7 +1404,7 @@ static size_t h1_process_output(struct h1c *h1c, struct buffer *buf, size_t coun
         * the HTX blocks.
         */
        if (!b_data(&h1c->obuf)) {
-               h1c->obuf.head = sizeof(struct htx);
+               h1c->obuf.head = sizeof(struct htx) + blk->addr;
 
                if (chn_htx->used == 1 &&
                    blk && htx_get_blk_type(blk) == HTX_BLK_DATA &&
index 4ca0907b6c29f47c550f53986f3be0fda983173e..d13bd95823a20ae79367b4362c73215c19153a64 100644 (file)
@@ -4335,7 +4335,7 @@ static size_t h2s_htx_frt_make_resp_data(struct h2s *h2s, struct buffer *buf, si
                 * frame header there.
                 */
                h2c->mbuf.area = buf->area;
-               h2c->mbuf.head = sizeof(struct htx) - 9;
+               h2c->mbuf.head = sizeof(struct htx) + blk->addr - 9;
                h2c->mbuf.data = fsize + 9;
                outbuf.area    = b_head(&h2c->mbuf);