Skip to content

Commit e4e7965

Browse files
committed
BUG/MAJOR: mux-h1: Properly copy chunked input data during zero-copy nego
When data are transfered via zero-copy data forwarding, if some data were already received, we try to immediately tranfer it during the negociation step. If data are chunked and the chunk size is unknown, 10 bytes are reserved to write the chunk size during the done step. However, when input data are finally transferred, the offset is ignored. Data are copied into the output buffer. But the first 10 bytes are then crushed by the chunk size. Thus the chunk is truncated leading to a malformed message. This patch should fix the issue #2598. It must be backported to 3.0. (cherry picked from commit e8cc8a6) Signed-off-by: Christopher Faulet <[email protected]>
1 parent 913b7b6 commit e4e7965

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/mux_h1.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4724,7 +4724,9 @@ static size_t h1_nego_ff(struct stconn *sc, struct buffer *input, size_t count,
47244724

47254725
if (xfer > b_data(input))
47264726
xfer = b_data(input);
4727+
h1c->obuf.head += offset;
47274728
h1s->sd->iobuf.data = b_xfer(&h1c->obuf, input, xfer);
4729+
h1c->obuf.head -= offset;
47284730

47294731
/* Cannot forward more data, wait for room */
47304732
if (b_data(input))

0 commit comments

Comments
 (0)