]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: compression: correctly report incoming byte count
authorWilly Tarreau <w@1wt.eu>
Wed, 23 Apr 2014 17:31:17 +0000 (19:31 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 23 Apr 2014 17:31:17 +0000 (19:31 +0200)
The fixes merged into 1.5-dev23 on compression resulted in the input
byte count not being correctly computed and always reported as zero.

src/compression.c

index 17a81e80e64b54a89319bcba9417f282e0d7ff3f..09bc4a6e9f2b50c5fff6921004cbae3f40314c92 100644 (file)
@@ -211,7 +211,7 @@ int http_compression_buffer_add_data(struct session *s, struct buffer *in, struc
  */
 int http_compression_buffer_end(struct session *s, struct buffer **in, struct buffer **out, int end)
 {
-       int to_forward, forwarded;
+       int to_forward;
        int left;
        struct http_msg *msg = &s->txn.rsp;
        struct buffer *ib = *in, *ob = *out;
@@ -266,14 +266,13 @@ int http_compression_buffer_end(struct session *s, struct buffer **in, struct bu
        to_forward = ob->i;
 
        /* update input rate */
-       forwarded = ib->o - ob->o;
        if (s->comp_ctx && s->comp_ctx->cur_lvl > 0) {
-               update_freq_ctr(&global.comp_bps_in, forwarded);
-               s->fe->fe_counters.comp_in += forwarded;
-               s->be->be_counters.comp_in += forwarded;
+               update_freq_ctr(&global.comp_bps_in, msg->next);
+               s->fe->fe_counters.comp_in += msg->next;
+               s->be->be_counters.comp_in += msg->next;
        } else {
-               s->fe->fe_counters.comp_byp += forwarded;
-               s->be->be_counters.comp_byp += forwarded;
+               s->fe->fe_counters.comp_byp += msg->next;
+               s->be->be_counters.comp_byp += msg->next;
        }
 
        /* copy the remaining data in the tmp buffer. */