]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: log: Don't depends on a stream to process samples in log-format string
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 6 Apr 2020 08:40:02 +0000 (10:40 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 27 Apr 2020 07:39:37 +0000 (09:39 +0200)
When a log-format string is evaluated, there is no reason to process sample
fetches only when a stream is defined. Several sample fetches are available
outside the stream scope. All others should handle calls without stream. This
patch is mandatory to support log-format string in tcp-check rules.

src/log.c

index 5204de2b2d343e20c98428eaa7e7d3f32835f4d2..4f3c7c710af16bfc4ca516bf55318c48cc0caf7e 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -2065,9 +2065,9 @@ int sess_build_logline(struct session *sess, struct stream *s, char *dst, size_t
 
                        case LOG_FMT_EXPR: // sample expression, may be request or response
                                key = NULL;
-                               if (tmp->options & LOG_OPT_REQ_CAP && s)
+                               if (tmp->options & LOG_OPT_REQ_CAP)
                                        key = sample_fetch_as_type(be, sess, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL, tmp->expr, SMP_T_STR);
-                               if (!key && (tmp->options & LOG_OPT_RES_CAP) && s)
+                               if (!key && (tmp->options & LOG_OPT_RES_CAP))
                                        key = sample_fetch_as_type(be, sess, s, SMP_OPT_DIR_RES|SMP_OPT_FINAL, tmp->expr, SMP_T_STR);
                                if (tmp->options & LOG_OPT_HTTP)
                                        ret = lf_encode_chunk(tmplog, dst + maxsize,