BUG/MEDIUM: http-fetch: Don't fetch the method if there is no stream
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.
(cherry picked from commit 12f6dbb863fe941c6d84cf3d521dfcb4c0e2f355)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 43cb3de242d2883baf9711ab04b0abee1e7484c3)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 1aa787d0dc34c72fda05bd39b3e4662aa24aedd8)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/http_fetch.c b/src/http_fetch.c
index 891783d..3950eea 100644
--- a/src/http_fetch.c
+++ b/src/http_fetch.c
@@ -333,7 +333,7 @@
struct htx *htx;
int meth;
- txn = smp->strm->txn;
+ txn = (smp->strm ? smp->strm->txn : NULL);
if (!txn)
return 0;