]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: h3: reject reserved HTTP/2 frame types
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 24 Nov 2026 09:56:15 +0000 (10:56 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 24 Nov 2026 10:38:18 +0000 (11:38 +0100)
RFC 9114 defines HTTP/2 frame types with no correspondence in HTTP/3 as
reserved. They must not be sent. Upon receipt, the connection must be
closed with an H3_FRAME_UNEXPECTED error.

Enum h3_ft has been extended to cover these reserved values. Implement
the proper rejection of these types in h3_check_frame_valid().

This must be backported up to 2.6.

include/haproxy/h3.h
src/h3.c

index ec6da8a3f56a9cde3efdcf3b60d2b4cdae6150ad..cae705a6f1dfbf917eac635b457b41ef5630c11b 100644 (file)
@@ -76,12 +76,14 @@ enum h3_ft       {
 
        H3_FT_DATA         = 0x00,
        H3_FT_HEADERS      = 0x01,
-       /* hole */
+       H3_FT_RESERVED_1   = 0x02,
        H3_FT_CANCEL_PUSH  = 0x03,
        H3_FT_SETTINGS     = 0x04,
        H3_FT_PUSH_PROMISE = 0x05,
-       /* hole */
+       H3_FT_RESERVED_2   = 0x06,
        H3_FT_GOAWAY       = 0x07,
+       H3_FT_RESERVED_3   = 0x08,
+       H3_FT_RESERVED_4   = 0x09,
        /* hole */
        H3_FT_MAX_PUSH_ID  = 0x0d,
 };
index 91e4004dd99fde09aefb105ac71f5ee2e35d954b..1b81854256e045b19e62d1a573f14fef86439864 100644 (file)
--- a/src/h3.c
+++ b/src/h3.c
@@ -468,6 +468,20 @@ static int h3_check_frame_valid(struct h3c *h3c, struct qcs *qcs, uint64_t ftype
                        ret = H3_ERR_MISSING_SETTINGS;
                break;
 
+       case H3_FT_RESERVED_1:
+       case H3_FT_RESERVED_2:
+       case H3_FT_RESERVED_3:
+       case H3_FT_RESERVED_4:
+               /* RFC 9114 7.2.8. Reserved Frame Types
+                *
+                * Frame types that were used in HTTP/2 where there is no corresponding
+                * HTTP/3 frame have also been reserved (Section 11.2.1). These frame
+                * types MUST NOT be sent, and their receipt MUST be treated as a
+                * connection error of type H3_FRAME_UNEXPECTED.
+                */
+               ret = H3_ERR_FRAME_UNEXPECTED;
+               break;
+
        default:
                /* RFC 9114 9. Extensions to HTTP/3
                 *
@@ -4026,11 +4040,15 @@ static inline const char *h3_ft_str(uint64_t type)
        switch (type) {
        case H3_FT_DATA:         return "DATA";
        case H3_FT_HEADERS:      return "HEADERS";
+       case H3_FT_RESERVED_1:   return "RESERVED_1";
        case H3_FT_SETTINGS:     return "SETTINGS";
        case H3_FT_PUSH_PROMISE: return "PUSH_PROMISE";
-       case H3_FT_MAX_PUSH_ID:  return "MAX_PUSH_ID";
+       case H3_FT_RESERVED_2:   return "RESERVED_2";
        case H3_FT_CANCEL_PUSH:  return "CANCEL_PUSH";
        case H3_FT_GOAWAY:       return "GOAWAY";
+       case H3_FT_RESERVED_3:   return "RESERVED_3";
+       case H3_FT_RESERVED_4:   return "RESERVED_4";
+       case H3_FT_MAX_PUSH_ID:  return "MAX_PUSH_ID";
        default:                 return "_UNKNOWN_";
        }
 }