]> git.kaiwu.me - nginx.git/commit
Add RFC 9218 priority types and parser
authorAndrew Clayton <a.clayton@nginx.com>
Wed, 23 Sep 2026 20:09:36 +0000 (21:09 +0100)
committerAndrew Clayton <a.clayton@nginx.com>
Mon, 28 Sep 2026 21:01:20 +0000 (22:01 +0100)
commitb5bd4b34871ecaed15a64cb446172f280e56d4d7
tree2d47106208d1538bcf5c9f53018ea703c7a81ad8
parent939334efff3575ce52597cc8c13d55821044ac57
Add RFC 9218 priority types and parser

Implement a strict RFC 8941 Structured Fields Dictionary parser for the
RFC 9218 Extensible Prioritization Scheme, shared by HTTP/2 (and, later,
HTTP/3).

New files:
- ngx_http_priority.h: the ngx_http_priority_t and
  ngx_http_priority_state_t types and the parse/state API.
- ngx_http_priority.c: the parser plus ngx_http_priority_state_init()
  and ngx_http_priority_state_update() (client/server merge).

The field is parsed strictly: a syntax error fails the whole field
(RFC 8941, Section 4.2, treats it as absent), and only on a successful
parse are the RFC 9218, Section 4, rules applied, ignoring unknown
members, out-of-range urgency and members of an unexpected type.  On
error the caller keeps any previously signalled priority.  The parser
bounds the number of members, inner-list items and parameters, and the
length of individual strings, tokens and byte sequences, that it will
accept.

The sources are built only with HTTP/2 (for now), alongside the Huffman
sources, rather than unconditionally into the core HTTP module.

Assisted-by: opencode:claude-opus-4.8
auto/modules
auto/sources
src/http/ngx_http.h
src/http/ngx_http_priority.c [new file with mode: 0644]
src/http/ngx_http_priority.h [new file with mode: 0644]