]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: h1: keep accepting unsafe violations after a parser reset
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 7 Oct 2026 08:34:08 +0000 (10:34 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 16 Oct 2026 17:07:18 +0000 (19:07 +0200)
commit298bd3d474f8b4606494452765024fbdd095aabf
tree86f55af7ae16fbfc3875aa1bd47debdb44d70e81
parenta71005572b6cdfbb972fd5df554cff1c8718bf6a
BUG/MINOR: h1: keep accepting unsafe violations after a parser reset

The H1 parser relies on h1m->err_pos being preset to -1 instead of -2 to
accept some violations ("option accept-unsafe-violations-in-http-request"
and "option accept-unsafe-violations-in-http-response"). The H1 mux sets it
when the H1 stream is created. However the H1 message is reset in a few
places using h1m_init_req() or h1m_init_res(), which set err_pos back to -2:

  - in h1_process_demux(), when a 1xx interim response was received, to
    parse the final response;

  - in h1_postparse_req_hdrs() and h1_postparse_res_hdrs(), when the headers
    do not fit in the output buffer and the parsing must be restarted later.

As a result, the strict mode is silently enforced on the final response
following a 1xx interim response (or after an output full condition), and a
response accepted otherwise is rejected with a 502.

To fix the issue, the lenient mode is restored after these resets: from the
proxy's options in the mux, and from the previous err_pos value in the
h1_postparse_* functions.

This should be backported to all stable versions.
src/h1_htx.c
src/mux_h1.c