BUG/MEDIUM: httpclient: don't consume data before it was analyzed
authorWilliam Lallemand <wlallemand@haproxy.org>
Thu, 24 Feb 2022 15:55:41 +0000 (16:55 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 14 Mar 2022 14:26:37 +0000 (15:26 +0100)
commitb9bf1623d67c57acc97ff61ea1b5635215526d6e
tree2806adeb3e870ba30e70244156d39626f30405d7
parent6fd9fd210ddf9856684595e67c1e6f6804894f37
BUG/MEDIUM: httpclient: don't consume data before it was analyzed

In httpclient_applet_io_handler(), on the response path, we don't check
if the data are in the output part of the channel, and could consume
them before they were analyzed.

To fix this issue, this patch checks for the stline and the headers if
the msg_state is >= HTTP_MSG_DATA which means the stline and headers
were analyzed. For the data part, it checks if each htx blocks is in the
output before copying it.

Must be backported in 2.5.

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