]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: h3: ensure that invalid status code are not encoded (FE side)
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 15 Jul 2025 16:15:36 +0000 (18:15 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 15 Jul 2025 16:39:23 +0000 (18:39 +0200)
commitd8b34459b52027d0621ebb0ac146fa277ab8e2ba
tree4488487ad7a926e64ca8153f5b835d7b8971c96b
parentd59bdfb8ec5b5af284672af8a89bf0d1662d8efd
BUG/MINOR: h3: ensure that invalid status code are not encoded (FE side)

On frontend side, H3 layer transcodes HTX status code into HTTP/3
HEADERS frame. This is done by calling qpack_encode_int_status().

Prior to this patch, the latter function was also responsible to reject
an invalid value, which guarantee that only valid codes are encoded
(between 100 and 999 values). However, this is not practical as it is
impossible to differentiate between an invalid code error and a buffer
room exhaustation.

Changes this so that now HTTP/3 layer first ensures that HTX code is
valid. The stream is closed with H3_INTERNAL_ERROR if invalid value is
present. Thus, qpack_encode_int_status() will only report an error due
to buffer room exhaustion. If a small buffer is used, a standard buffer
will be reallocated which should be sufficient to encode the response.

The impact of this bug is minimal. Its main benefit is code clarity,
while also removing an unnecessary realloc when confronting with an
invalid HTTP code.

This should be backported at least up to 3.1. Prior to it, smallbuf
mechanism isn't present, hence the impact of this patch is less
important. However, it may still be backported to older versions, which
should facilitate picking patches for HTTP 1xx interim response support.
src/h3.c
src/qpack-enc.c