]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: http: Fix tunnel mode when the CONNECT method is used
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 28 Nov 2016 09:14:03 +0000 (10:14 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 29 Nov 2016 16:00:14 +0000 (17:00 +0100)
commitd1cd209b21865c69761e4d5005a9f36423a38479
treed25672ea339b9975be62a8f2a1e5f17782d7e4c3
parent4896c440b3e270a9acd41d2692ecc8bf5d7636fa
BUG/MEDIUM: http: Fix tunnel mode when the CONNECT method is used

When a 2xx response to a CONNECT request is returned, the connection must be
switched in tunnel mode immediatly after the headers, and Transfer-Encoding and
Content-Length headers must be ignored. So from the HTTP parser point of view,
there is no body.

The bug comes from the fact the flag HTTP_MSGF_XFER_LEN was not set on the
response (This flag means that the body size can be determined. In our case, it
can, it is 0). So, during data forwarding, the connection was never switched in
tunnel mode and we were blocked in a state where we were waiting that the
server closes the connection to ends the response.

Setting the flag HTTP_MSGF_XFER_LEN on the response fixed the bug.

The code of http_wait_for_response has been slightly updated to be more
readable.

[wt: 1.7-only, this is not needed in 1.6]
src/proto_http.c