From 09f88364b7c654980581d547aca696d44896c404 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Thu, 1 Apr 2021 16:00:29 +0200 Subject: [PATCH] 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. --- src/http_fetch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/http_fetch.c b/src/http_fetch.c index a4db061c1..0d2be7ea4 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)