Skip to content

Commit 9854b6f

Browse files
committed
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.
1 parent c2638c8 commit 9854b6f

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/hq_interop.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,14 @@ static size_t hq_interop_snd_buf(struct qcs *qcs, struct buffer *buf,
274274

275275
/* only body is transferred on HTTP/0.9 */
276276
case HTX_BLK_RES_SL:
277+
sl = htx_get_blk_ptr(htx, blk);
278+
if (!(sl->flags & HTX_SL_F_XFER_LEN))
279+
qcs->flags |= QC_SF_UNKNOWN_PL_LENGTH;
280+
htx_remove_blk(htx, blk);
281+
total += bsize;
282+
count -= bsize;
283+
break;
284+
277285
case HTX_BLK_TLR:
278286
case HTX_BLK_EOT:
279287
default:

0 commit comments

Comments
 (0)