]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: h1: better handle transfer-encoding vs content-length
authorWilly Tarreau <w@1wt.eu>
Fri, 14 Sep 2018 14:34:47 +0000 (16:34 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 14 Sep 2018 15:40:35 +0000 (17:40 +0200)
commit2557f6a3e24ade33f4a367d3ffc8762f4b9305db
tree47bac04acf0dc1aaaffbd2af85bab707385c1f44
parent2ea6bb5c31c32150cb96245cd2bd574c66262cee
MEDIUM: h1: better handle transfer-encoding vs content-length

The transfer-encoding header processing was a bit lenient in this part
because it was made to read messages already validated by haproxy. We
absolutely need to reinstate the strict processing defined in RFC7230
as is currently being done in proto_http.c. That is, transfer-encoding
presence alone is enough to cancel content-length, and must be
terminated by the "chunked" token, except in the response where we
can fall back to the close mode if it's not last.

For this we now use a specific parsing function which updates the
flags and we introduce a new flag H1_MF_XFER_ENC indicating that the
transfer-encoding header is present.

Last, if such a header is found, we delete all content-length header
fields found in the message.
include/types/h1.h
src/h1.c