BUG/MEDIUM: mux-h1: Explicitly skip request's C-L header if not set originally
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 12 Dec 2023 12:56:05 +0000 (13:56 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 14 Dec 2023 08:58:22 +0000 (09:58 +0100)
commit9c5765fde8b3936c5ef06c95a799a8a88410085c
tree1f1fef4e7b112271aba3ae41d444540b23f5bebd
parent60de35cef643ed8eb42dce5f7948231d847ec24e
BUG/MEDIUM: mux-h1: Explicitly skip request's C-L header if not set originally

Commit f89ba27caa ("BUG/MEDIUM: mux-h1; Ignore headers modifications about
payload representation") introduced a regression. The Content-Length is no
longer sent to the server for requests without payload but with a
'Content-Lnegth' header explicitly set to 0, like POST request with no
payload. It is of course unexpected. In some cases, depending on the server,
such requests are considered as invalid and a 411-Length-Required is returned.

The above commit is not directly responsible for the bug, it only reveals a too
lax condition to skip the 'Content-Length' header of bodyless requests. We must
only skip this header if none was originally found, during the parsing.

This patch should fix the issue #2386. It must be backported to 2.9.

(cherry picked from commit 966a18e2b485901bd986ebe65670dc4bfbfe65b5)
Signed-off-by: Willy Tarreau <w@1wt.eu>
src/mux_h1.c