mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 22:31:28 +02:00
BUG/MEDIUM: log: Don't call sample_fetch_as_type if we don't have a stream.
In sess_build_logline(), don't attempt to call sample_fetch_as_type() if we don't have a stream. It used never to happen in the past before commit 09bb27c ("MEDIUM: log: make sess_build_logline() support being called with no stream"). But now it can happen when sess_log() is called from the lower layers (i.e. the H2 mux got garbage when it was expecting a preface frame), and it reveals that some sample fetch functions and some converter fnuctions which rely on the stream don't test for its existence. For the sample fetch functions, a durable solution is easy and would consist in adapting sample_process() to verify the SMP_USE_* bits when the stream is not set. But for the converters we don't have this option as they don't declare whether or not they use a stream (which possibly is the real issue). Thus for now let's disable sample_fetch_as_type() if a stream does not exist, until it can be more accurately refined later.
This commit is contained in:
parent
a57b7e33ef
commit
f90db445cd
@ -1801,9 +1801,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
|
case LOG_FMT_EXPR: // sample expression, may be request or response
|
||||||
key = NULL;
|
key = NULL;
|
||||||
if (tmp->options & LOG_OPT_REQ_CAP)
|
if (tmp->options & LOG_OPT_REQ_CAP && s)
|
||||||
key = sample_fetch_as_type(be, sess, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL, tmp->expr, SMP_T_STR);
|
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))
|
if (!key && (tmp->options & LOG_OPT_RES_CAP) && s)
|
||||||
key = sample_fetch_as_type(be, sess, s, SMP_OPT_DIR_RES|SMP_OPT_FINAL, tmp->expr, SMP_T_STR);
|
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)
|
if (tmp->options & LOG_OPT_HTTP)
|
||||||
ret = lf_encode_chunk(tmplog, dst + maxsize,
|
ret = lf_encode_chunk(tmplog, dst + maxsize,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user