From: Amaury Denoyelle Date: Tue, 24 Nov 2026 09:56:15 +0000 (+0100) Subject: BUG/MINOR: h3: reject reserved HTTP/2 frame types X-Git-Url: https://git.kaiwu.me/http/%7B@url%7D?a=commitdiff_plain;h=c128c7905cb31b318c84c5fd3534916717d0de94;p=haproxy.git BUG/MINOR: h3: reject reserved HTTP/2 frame types 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. --- diff --git a/include/haproxy/h3.h b/include/haproxy/h3.h index ec6da8a3f..cae705a6f 100644 --- a/include/haproxy/h3.h +++ b/include/haproxy/h3.h @@ -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, }; diff --git a/src/h3.c b/src/h3.c index 91e4004dd..1b8185425 100644 --- 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_"; } }