From: Willy Tarreau Date: Tue, 27 Nov 2012 06:35:31 +0000 (+0100) Subject: MINOR: compression: make the stats a bit more robust X-Git-Tag: v1.5-dev15~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8139b9959f31a4822f9c55fc8622481525725894;p=thirdparty%2Fhaproxy.git MINOR: compression: make the stats a bit more robust To ensure that we only count when a response was compressed, we also check for the SN_COMP_READY flag which indicates that the compression was effectively initialized. Comp_algo alone is meaningless. --- diff --git a/src/proto_http.c b/src/proto_http.c index 3184e24fd5..c01dfd288f 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -4040,14 +4040,14 @@ void http_end_txn_clean_session(struct session *s) if (s->fe->mode == PR_MODE_HTTP) { s->fe->fe_counters.p.http.rsp[n]++; - if (s->comp_algo) + if (s->comp_algo && (s->flags & SN_COMP_READY)) s->fe->fe_counters.p.http.comp_rsp++; } if ((s->flags & SN_BE_ASSIGNED) && (s->be->mode == PR_MODE_HTTP)) { s->be->be_counters.p.http.rsp[n]++; s->be->be_counters.p.http.cum_req++; - if (s->comp_algo) + if (s->comp_algo && (s->flags & SN_COMP_READY)) s->be->be_counters.p.http.comp_rsp++; } } diff --git a/src/session.c b/src/session.c index 9aac91d40e..330d7228f8 100644 --- a/src/session.c +++ b/src/session.c @@ -2435,14 +2435,14 @@ struct task *process_session(struct task *t) if (s->fe->mode == PR_MODE_HTTP) { s->fe->fe_counters.p.http.rsp[n]++; - if (s->comp_algo) + if (s->comp_algo && (s->flags & SN_COMP_READY)) s->fe->fe_counters.p.http.comp_rsp++; } if ((s->flags & SN_BE_ASSIGNED) && (s->be->mode == PR_MODE_HTTP)) { s->be->be_counters.p.http.rsp[n]++; s->be->be_counters.p.http.cum_req++; - if (s->comp_algo) + if (s->comp_algo && (s->flags & SN_COMP_READY)) s->be->be_counters.p.http.comp_rsp++; } }