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.

(cherry picked from commit 31850b470a9c59d04349174df6b51de1efe41420)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit a9f36628395b012cef7f9efddaf90954b68ff167)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 5df4953f8dee79c523c7cd5089f660e15bea9821)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 979d9b8ecd6dcc3de848140cdbb6c27482721934)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
1 file changed