From 5ede40be6763d3515164e8d123b7d6aaed27624b Mon Sep 17 00:00:00 2001 From: Amaury Denoyelle Date: Tue, 7 Dec 2021 16:19:03 +0100 Subject: [PATCH] MINOR: hq-interop: fix tx buffering On h09 app layer, if there is not enought size in the tx buffer, the transfer is interrupted and the flag QC_SF_BLK_MROOM is positionned. The transfer is woken up by the mux when new buffer size becomes available. This ensure that no data is silently discarded during transfer. Without this, once the buffer is full the data were removed and thus not send to the client resulting in a truncating payload. --- src/hq_interop.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/hq_interop.c b/src/hq_interop.c index 075e785b04..dc1e1154e6 100644 --- a/src/hq_interop.c +++ b/src/hq_interop.c @@ -94,6 +94,15 @@ static size_t hq_interop_snd_buf(struct conn_stream *cs, struct buffer *buf, case HTX_BLK_DATA: if (fsize > count) fsize = count; + + if (b_size(&outbuf) < fsize) + fsize = b_size(&outbuf); + + if (!fsize) { + qcs->flags |= QC_SF_BLK_MROOM; + goto end; + } + b_putblk(&outbuf, htx_get_blk_ptr(htx, blk), fsize); total += fsize; count -= fsize; @@ -116,6 +125,7 @@ static size_t hq_interop_snd_buf(struct conn_stream *cs, struct buffer *buf, } } + end: if ((htx->flags & HTX_FL_EOM) && htx_is_empty(htx)) qcs->flags |= QC_SF_FIN_STREAM; -- 2.47.3