]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: compression: make the stats a bit more robust
authorWilly Tarreau <w@1wt.eu>
Tue, 27 Nov 2012 06:35:31 +0000 (07:35 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 27 Nov 2012 08:34:00 +0000 (09:34 +0100)
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.

src/proto_http.c
src/session.c

index 3184e24fd5f9d977848a5dcb0704fa0f00b31cbb..c01dfd288fbf92e7d253b42ffd865ea4c752890e 100644 (file)
@@ -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++;
                }
        }
index 9aac91d40ec0fcfb2df802032ed3ee46aaec89ab..330d7228f87b728a84bc3af05fd8b08b76908d0d 100644 (file)
@@ -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++;
                }
        }