From: Amaury Denoyelle Date: Mon, 16 Nov 2026 15:56:53 +0000 (+0100) Subject: BUG/MINOR: hq-interop: drop data after request X-Git-Tag: v3.5-dev13~57 X-Git-Url: https://git.kaiwu.me/web/%22data:,/doc/static/%7B@url%7D?a=commitdiff_plain;h=fa2d25b7df4f8a961e637e71fd0755e4ed8b63ae;p=haproxy.git BUG/MINOR: hq-interop: drop data after request Strengthen hq-interop by silently draining any data following the request. This ensures that a QCS instance won't be used to convey multiple requests as this is undefined behavior. This new check has been merged with the handling of a delayed standalone FIN. This ensures that FIN is never forgotten, whether it is received with or without extra data after the request. This may be backported to stable releases if needed. --- diff --git a/src/hq_interop.c b/src/hq_interop.c index 122348570..dab14833a 100644 --- a/src/hq_interop.c +++ b/src/hq_interop.c @@ -38,10 +38,13 @@ static ssize_t hq_interop_rcv_buf_req(struct qcs *qcs, struct buffer *b, int fin /* hq-interop parser does not support buffer wrapping. */ BUG_ON(b_data(b) != b_contig_data(b, 0)); - if (!b_data(b) && fin) { - if (qcs_http_handle_standalone_fin(qcs, 0)) + if (unlikely(qcs->sd) || (fin && !data)) { + /* Drain any data after the request and handle FIN if present, + * including the case where it is set without any payload. + */ + if (fin && qcs_http_handle_standalone_fin(qcs, 0)) return -1; - return 0; + return data; } /* skip method */