]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: http-fetch: Don't fetch the method if there is no stream
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 6 Jul 2022 15:53:02 +0000 (17:53 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 7 Jul 2022 07:35:58 +0000 (09:35 +0200)
The "method" sample fetch does not perform any check on the stream existence
before using it. However, for errors triggered at the mux level, there is no
stream. When the log message is formatted, this sample fetch must fail. It
must also fail when it is called from a health-check.

This patch must be backported as far as 2.4.

src/http_fetch.c

index 1c331e0aede2c911f3cd9b19f278ffe6b4bcd78c..f70fc7f0332c2f103fabc14aa497d58cd2c429d5 100644 (file)
@@ -337,7 +337,7 @@ static int smp_fetch_meth(const struct arg *args, struct sample *smp, const char
        struct htx *htx;
        int meth;
 
-       txn = smp->strm->txn;
+       txn = (smp->strm ? smp->strm->txn : NULL);
        if (!txn)
                return 0;