MINOR: h1: Change T-E header parsing to fail if chunked encoding is found twice
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 28 Sep 2021 07:36:25 +0000 (09:36 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 28 Sep 2021 14:21:25 +0000 (16:21 +0200)
commit545fbba2733a1f611ce940ecd5fbea1130b6d503
tree70be33be8ac98602f9fcc6da46f94720182d4e9a
parent92cafb39e70c1f2a178726e52cff52d0d0a0ab58
MINOR: h1: Change T-E header parsing to fail if chunked encoding is found twice

According to the RFC7230, "chunked" encoding must not be applied more than
once to a message body. To handle this case, h1_parse_xfer_enc_header() is
now responsible to fail when a parsing error is found. It also fails if the
"chunked" encoding is not the last one for a request.

To help the parsing, two H1 parser flags have been added: H1_MF_TE_CHUNKED
and H1_MF_TE_OTHER. These flags are set, respectively, when "chunked"
encoding and any other encoding are found. H1_MF_CHNK flag is used when
"chunked" encoding is the last one.
include/haproxy/h1.h
src/h1.c
src/hlua.c