]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: fl_trace/htx: Be sure to always forward trailers and EOM
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 12 Jun 2019 14:07:48 +0000 (16:07 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 14 Jun 2019 09:13:32 +0000 (11:13 +0200)
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

index cd691456145b5839ca1c30127c665c25ea898517..c0660acab161420fa43ad35bd0426b19d14bd600 100644 (file)
@@ -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) - "