From: Christopher Faulet Date: Thu, 1 Apr 2021 14:00:29 +0000 (+0200) Subject: BUG/MINOR: http-fetch: Fix test on message state to capture the version X-Git-Tag: v2.4-dev15~34 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=09f88364b7c654980581d547aca696d44896c404;p=thirdparty%2Fhaproxy.git BUG/MINOR: http-fetch: Fix test on message state to capture the version A bug was introduced when the legacy HTTP mode was removed. To capture the HTTP version of the request or the response, we rely on the message state to be sure the status line was received. However, the test is inverted. The version can be captured if message headers were received, not the opposite. This patch must be backported as far as 2.2. --- diff --git a/src/http_fetch.c b/src/http_fetch.c index a4db061c16..0d2be7ea40 100644 --- a/src/http_fetch.c +++ b/src/http_fetch.c @@ -1525,7 +1525,7 @@ static int smp_fetch_capture_req_ver(const struct arg *args, struct sample *smp, return 0; txn = smp->strm->txn; - if (!txn || txn->req.msg_state >= HTTP_MSG_BODY) + if (!txn || txn->req.msg_state < HTTP_MSG_BODY) return 0; if (txn->req.flags & HTTP_MSGF_VER_11) @@ -1551,7 +1551,7 @@ static int smp_fetch_capture_res_ver(const struct arg *args, struct sample *smp, return 0; txn = smp->strm->txn; - if (!txn || txn->rsp.msg_state >= HTTP_MSG_BODY) + if (!txn || txn->rsp.msg_state < HTTP_MSG_BODY) return 0; if (txn->rsp.flags & HTTP_MSGF_VER_11)