From 647fe1d9e1359072021c15c459f728bdc348236d Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Wed, 12 Jun 2019 16:07:48 +0200 Subject: [PATCH] BUG/MINOR: fl_trace/htx: Be sure to always forward trailers and EOM Previous fix about the random forwarding on the message body was not enough to fix the bug in all cases. Among others, when there is no data but only the EOM, we must forward everything. This patch must be backported to 1.9 if the patch 0bdeeaacb ("BUG/MINOR: flt_trace/htx: Only apply the random forwarding on the message body.") is also backported. --- src/flt_trace.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/flt_trace.c b/src/flt_trace.c index cd6914561..c0660acab 100644 --- a/src/flt_trace.c +++ b/src/flt_trace.c @@ -486,10 +486,11 @@ trace_http_payload(struct stream *s, struct filter *filter, struct http_msg *msg break; } } - - ret = random() % (ret+1); - if (ret > data) - ret = len; + if (data) { + ret = random() % (ret+1); + if (!ret || ret >= data) + ret = len; + } } STRM_TRACE(conf, s, "%-25s: channel=%-10s - mode=%-5s (%s) - "