MINOR: log: Don't depends on a stream to process samples in log-format string

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.
This commit is contained in:
Christopher Faulet 2020-04-06 10:40:02 +02:00
parent f50f4e956f
commit 5f940703b3

View File

@ -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,