]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: mux-quic: Drain the given amount of data in qcs_http_reset_buf()
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 24 Jun 2026 15:22:29 +0000 (17:22 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 24 Jun 2026 18:51:41 +0000 (20:51 +0200)
Name of qcs_http_reset_buf() function is confusing. But the comment is
clear. In this function, a given amount of HTX data must be cleared from the
buffer. However, concretely, the whole buffer was always reset. Most of time
it is equivalent but it could be possible to keep unsent data in the
buffer. For instance, when a filter is registered on the data forwarding
stage.

So, instead of calling htx_reset(), htx_drain() must be used.

This patch must be backported to all supported version.

src/qcm_http.c

index 962ebc8bc6e98f56997889be4bdae28d9cdb1a4b..c2f0ae1ebcc6f243ad74455bfdc21403e18bd3ff 100644 (file)
@@ -111,14 +111,15 @@ size_t qcs_http_snd_buf(struct qcs *qcs, struct buffer *buf, size_t count,
 size_t qcs_http_reset_buf(struct qcs *qcs, struct buffer *buf, size_t count)
 {
        struct htx *htx;
+       struct htx_ret htxret;
 
        TRACE_ENTER(QMUX_EV_STRM_SEND, qcs->qcc->conn, qcs);
 
        htx = htx_from_buf(buf);
-       htx_reset(htx);
+       htxret = htx_drain(htx, count);
        htx_to_buf(htx, buf);
 
        TRACE_LEAVE(QMUX_EV_STRM_SEND, qcs->qcc->conn, qcs);
 
-       return count;
+       return htxret.ret;
 }