]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: h3: report error on control stream close
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 16 Aug 2022 15:16:47 +0000 (17:16 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 17 Aug 2022 09:04:52 +0000 (11:04 +0200)
As specified by RFC 9114 the control stream must not be closed. If the
peer behaves incorrectly and closes it, emit a H3_CLOSED_CRITICAL_STREAM
connection error.

src/h3.c

index 688f9030a8413915beba7d42007bef2752799e84..026f7d9e71d93785cf45ec04aba2a5a0726050f4 100644 (file)
--- a/src/h3.c
+++ b/src/h3.c
@@ -625,6 +625,18 @@ static ssize_t h3_decode_qcs(struct qcs *qcs, struct buffer *b, int fin)
                return total;
        }
 
+       /* RFC 9114 6.2.1. Control Streams
+        *
+        * The sender MUST NOT close the control stream, and the receiver MUST NOT
+        * request that the sender close the control stream.  If either control
+        * stream is closed at any point, this MUST be treated as a connection
+        * error of type H3_CLOSED_CRITICAL_STREAM.
+        */
+       if (h3s->type == H3S_T_CTRL && fin) {
+               qcc_emit_cc_app(qcs->qcc, H3_CLOSED_CRITICAL_STREAM, 1);
+               return -1;
+       }
+
        while (b_data(b) && !(qcs->flags & QC_SF_DEM_FULL)) {
                uint64_t ftype, flen;
                char last_stream_frame = 0;