]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: flt_trace: Don't scrash the original offset during the random forwarding
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 11 Jun 2019 08:20:57 +0000 (10:20 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 11 Jun 2019 12:05:25 +0000 (14:05 +0200)
There is no bug here, but this patch improves the debug message reported during
the random forwarding. The original offset is kept untouched so its value may be
used to format the message. Before, 0 was always reported.

src/flt_trace.c

index e001d7b370381d015b8e04ee9ab89b6bd1004f08..cd691456145b5839ca1c30127c665c25ea898517 100644 (file)
@@ -468,18 +468,19 @@ trace_http_payload(struct stream *s, struct filter *filter, struct http_msg *msg
                struct htx *htx = htxbuf(&msg->chn->buf);
                struct htx_blk *blk;
                uint32_t sz, data = 0;
+               unsigned int off = offset;
 
                for (blk = htx_get_first_blk(htx); blk; blk = htx_get_next_blk(htx, blk)) {
                        if (htx_get_blk_type(blk) != HTX_BLK_DATA)
                                break;
 
                        sz = htx_get_blksz(blk);
-                       if (offset >= sz) {
-                               offset -= sz;
+                       if (off >= sz) {
+                               off -= sz;
                                continue;
                        }
-                       data  += sz - offset;
-                       offset = 0;
+                       data  += sz - off;
+                       off = 0;
                        if (data > len) {
                                data = len;
                                break;