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.
This commit is contained in:
Christopher Faulet 2021-04-01 16:00:29 +02:00
parent d57d9fe3d8
commit 09f88364b7
1 changed files with 2 additions and 2 deletions

View File

@ -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)