From 8bc48dfc1ef9ecb834251c8e0b5dce2e32604410 Mon Sep 17 00:00:00 2001 From: Amaury Denoyelle Date: Mon, 29 Jun 2026 09:54:22 +0200 Subject: [PATCH] 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. 1e144c488c612092067e07f18618482c64d33d17 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. --- src/hq_interop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hq_interop.c b/src/hq_interop.c index 3868cb2c4..a6ccfbddd 100644 --- a/src/hq_interop.c +++ b/src/hq_interop.c @@ -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) { -- 2.47.3