]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: http-fetch: Only fill txn status during prefetch if not already set
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 4 Jan 2023 09:11:32 +0000 (10:11 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 5 Jan 2023 08:33:23 +0000 (09:33 +0100)
commit31850b470a9c59d04349174df6b51de1efe41420
treeea709f017f2e88ad2b1b66922d241137d0ca2620
parent18cd4746e5aff9da78d16220b0412947ceba24f3
BUG/MINOR: http-fetch: Only fill txn status during prefetch if not already set

When an HTTP sample fetch is evaluated, a prefetch is performed to check the
channel contains a valid HTTP message. If the HTTP analysis was not already
started, some info are filled.

It may be an issue when an error is returned before the response analysis
and when http-after-response rules are used because the original HTTP txn
status may be crushed. For instance, with the following configuration:

  listen l1
    log global
    mode http
    bind :8000

    log-format ST=%ST
    http-after-response set-status 400
    #http-after-response set-var(res.foo) status

A "ST=503" is reported in the log messages, independantly on the first
http-after-response rule. The same must happen if the second rule is
uncommented. However, for now, a "ST=400" is logged.

To fix the bug, during the prefetch, the HTTP txn status is only set if it
is undefined (-1). This way, we are sure the original one is never lost.

This patch should be backported as far as 2.2.
src/http_fetch.c