]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: qpack: fix error code reported on QPACK decoding failure
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 13 May 2024 14:01:08 +0000 (16:01 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 15 May 2024 14:07:15 +0000 (16:07 +0200)
commit86aafd02365a132327a7a090a2a3f7c972785c21
tree40b8e0b05e7c6778c6025aa28e397cb63366ddda
parent4295dd21bd9f0ce463fcefacb921094b1a3f9b4f
BUG/MINOR: qpack: fix error code reported on QPACK decoding failure

qpack_decode_fs() is used to decode QPACK field section on HTTP/3
headers parsing. Its return value is incoherent as it returns either
QPACK_DECOMPRESSION_FAILED defined in RFC 9204 or any other internal
values defined in qpack-dec.h. On failure, such return code is reused by
HTTP/3 layer to be reported via a CONNECTION_CLOSE frame. This is
incorrect if an internal error values was reported as it is not defined
by any specification.

Fir return values of qpack_decode_fs() in two ways. Firstly, fix invalid
usages of QPACK_DECOMPRESSION_FAILED when decoded content is too large
for the correct internal error QPACK_ERR_TOO_LARGE.

Secondly, adjust qpack_decode_fs() API to only returns internal code
values. A new internal enum QPACK_ERR_DECOMP is defined to replace
QPACK_DECOMPRESSION_FAILED. Caller is responsible to convert it to a
suitable error value. For other internal values, H3_INTERNAL_ERROR is
used. This is done through a set of convert functions.

This should be backported up to 2.6. Note that trailers are not
supported in 2.6 so chunk related to h3_trailers_to_htx() can be safely
skipped.
include/haproxy/qpack-dec.h
src/h3.c
src/qpack-dec.c