BUG/MINOR: hq-interop: fix transcoding of wrapping response buffer

The below patch has implemented support for response wrapping in HTTP/0.9
transcoder, similar to what is already performed in HTTP/3.

  1e144c488c
  BUG/MINOR: hq-interop: support response buffer wrapping

However, some bits were incorrectly written and the transcoding would
not be able to handle all of the wrapping data in one pass, despite no
crash possible. This patch fixes these, so that a wrapping response can
be handled in a single pass by the HTTP/0.9 transcoder if there is
enough room in the output HTX buffer.

This should fix github issue #3430.

This should be backported up to 3.3.
This commit is contained in:
Amaury Denoyelle 2026-06-29 09:54:22 +02:00
parent 9d64d390c8
commit 8bc48dfc1e

View file

@ -116,7 +116,7 @@ static ssize_t hq_interop_rcv_buf_res(struct qcs *qcs, struct buffer *b, int fin
struct htx_sl *sl;
struct buffer *htx_buf;
const unsigned int flags = HTX_SL_F_VER_11|HTX_SL_F_XFER_LEN;
size_t to_copy = b_contig_data(b, 0);
size_t to_copy = b_data(b);
size_t htx_sent = 0;
uint32_t htx_space;
char *head;
@ -158,7 +158,7 @@ static ssize_t hq_interop_rcv_buf_res(struct qcs *qcs, struct buffer *b, int fin
fin = 0;
}
if (b_head(b) + to_copy > b_wrap(b)) {
if (head + to_copy > b_wrap(b)) {
size_t contig = b_wrap(b) - head;
htx_sent = htx_add_data(htx, ist2(b_head(b), contig));
if (htx_sent < contig) {