From 9854b6f98304f06a0fe4a421868f650d3291a1cb Mon Sep 17 00:00:00 2001 From: Amaury Denoyelle Date: Fri, 19 Jun 2026 10:09:17 +0200 Subject: [PATCH] BUG/MINOR: hq-interop: prevent reset if missing content-length HTTP/0.9 transcoder is minimal. In particular, it did not checked if the HTX payload length was unknown. In this case, the stream shutdown is the normal termination signal. As this condition was not reported to the MUX, the stream would be closed via a RESET_STREAM during the stream shut callback invokation. Fix this by properly inspecting HTX response line prior to generating the HTTP/0.9 response. If flag HTX_SL_F_XFER_LEN is not set, correctly convert it to QCS flag QC_SF_UNKNOWN_PL_LENGTH. This ensures that MUX will use a FIN signal instead of a RESET_STREAM frame when shut is called by the upper stream layer. This procedure is already implemented by HTTP/3 transcoder. This bug was detected with haterm, because contrary to httpterm the latter does not honour Connection keep-alive header in case of HTTP/1.0. Thus connection close mode is used and no content-length is added. This must be backported up to 2.8. --- src/hq_interop.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/hq_interop.c b/src/hq_interop.c index 137ef2acc..14fd7f223 100644 --- a/src/hq_interop.c +++ b/src/hq_interop.c @@ -274,6 +274,14 @@ static size_t hq_interop_snd_buf(struct qcs *qcs, struct buffer *buf, /* only body is transferred on HTTP/0.9 */ case HTX_BLK_RES_SL: + sl = htx_get_blk_ptr(htx, blk); + if (!(sl->flags & HTX_SL_F_XFER_LEN)) + qcs->flags |= QC_SF_UNKNOWN_PL_LENGTH; + htx_remove_blk(htx, blk); + total += bsize; + count -= bsize; + break; + case HTX_BLK_TLR: case HTX_BLK_EOT: default: -- 2.47.3