BUG/MEDIUM: http-ana: Don't release too early the L7 buffer
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 25 Nov 2024 21:05:27 +0000 (22:05 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 27 Nov 2024 14:05:33 +0000 (15:05 +0100)
commit525ebfea3a49b660a4453ec7e7a55c1517348257
tree68134135dc42eecc71c09ea2d9ad08fd08712303
parent704e2e471942c33bb8e25a9f341f4285fd4d950a
BUG/MEDIUM: http-ana: Don't release too early the L7 buffer

In some cases, the buffer used to store the request to be able to perform a
L7 retry is released released too early, leading to a crash because a retry
is performed with an empty request.

First, there is a test on invalid 101 responses that may be caught by the
"junk-response" retry policy. Then, it is possible to get an error
(empty-response, bad status code...) after an interim response. In both
cases, the L7 buffer is already released while it should not.

To fix the issue, the L7 buffer is now released at the end of the
AN_RES_WAIT_HTTP analyser, but only when a response was successfully
received and processed. In all error cases, the stream is quickly released,
with the L7 buffer. So there is no leak and it is safer this way.

This patch may fix the issue #2793. It must be as far as 2.4.

(cherry picked from commit dc15581c02171eeb49ef3ffbab0f583f38482b4c)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/http_ana.c