]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: hq-interop: drop data after request quic-interop
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 16 Nov 2026 15:56:53 +0000 (16:56 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 16 Nov 2026 16:45:49 +0000 (17:45 +0100)
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.

src/hq_interop.c

index 122348570b014893a985c15308d9a2cf17794988..dab14833a8d82e2de359df82d217f22c495c4317 100644 (file)
@@ -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 */