]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: mux-h1: only rely on the client's method for bodyless responses
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 7 Oct 2026 14:05:00 +0000 (16:05 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 16 Oct 2026 17:10:27 +0000 (19:10 +0200)
commit786d7077b0d803167aca7410e1403fb55d4915ec
treef07ba018cc810876a29606242fe29c38614a0344
parent4aa4c3d27b622f9da3910c548ff6b2027a21e5f4
BUG/MINOR: mux-h1: only rely on the client's method for bodyless responses

When the response is emitted to the client, the H1 stream is marked as
expecting a bodyless response if the HTX start-line has the
HTX_SL_F_BODYLESS_RESP flag, which is set when the response is parsed on the
server side for a response to a HEAD request. But this is the method sent to
the server, which may differ from the client's one. With "http-request
set-method HEAD" applied to a GET request, the response received from the
server has no payload but carries a content-length, which is forwarded to
the client. Since the response was considered as bodyless on the client
side, the connection was kept alive instead of being closed, so the client
took the next response as the payload of the first one:

    HTTP/1.1 200 OK\r\ncontent-length: 1234\r\n\r\nHTTP/1.1 200 OK\r\n...

A response to a client's HEAD request is already marked as bodyless when the
request is parsed. So only 204 and 304 statuses must be considered
here. Then the connection is closed as for any response announcing a payload
that is not received.

A reg-test was added for this.

This should be backported as far as 3.0.
reg-tests/http-messaging/h1_set_method_head_resp.vtc [new file with mode: 0644]
src/mux_h1.c