MINOR: stats: report the total number of compressed responses per front/back

Depending on the content-types and accept-encoding fields, some responses
might or might not be compressed. Let's have a counter of the number of
compressed responses and report it in the stats to help improve compression
usage.

Some cosmetic issues were fixed in the CSV output too (missing commas at the
end).
diff --git a/include/types/counters.h b/include/types/counters.h
index 8326429..efb48f6 100644
--- a/include/types/counters.h
+++ b/include/types/counters.h
@@ -57,6 +57,7 @@
 	union {
 		struct {
 			long long cum_req;      /* cumulated number of processed HTTP requests */
+			long long comp_rsp;     /* number of compressed responses */
 			unsigned int rps_max;   /* maximum of new HTTP requests second observed */
 			long long rsp[6];       /* http response codes */
 		} http;
diff --git a/src/dumpstats.c b/src/dumpstats.c
index ec27db8..0fef8f4 100644
--- a/src/dumpstats.c
+++ b/src/dumpstats.c
@@ -380,7 +380,7 @@
 			    "hrsp_1xx,hrsp_2xx,hrsp_3xx,hrsp_4xx,hrsp_5xx,hrsp_other,hanafail,"
 			    "req_rate,req_rate_max,req_tot,"
 			    "cli_abrt,srv_abrt,"
-			     "comp_in, comp_out, comp_byp,"
+			    "comp_in,comp_out,comp_byp,comp_rsp,"
 			    "\n");
 }
 
@@ -2473,6 +2473,10 @@
 						chunk_appendf(&trash, " %dxx=%lld,", i, px->fe_counters.p.http.rsp[i]);
 
 					chunk_appendf(&trash, " other=%lld,", px->fe_counters.p.http.rsp[0]);
+					chunk_appendf(&trash, " compressed=%lld (%d%%)",
+					              px->fe_counters.p.http.comp_rsp,
+					              px->fe_counters.p.http.cum_req ?
+					              (int)(100*px->fe_counters.p.http.comp_rsp/px->fe_counters.p.http.cum_req) : 0);
 					chunk_appendf(&trash, " intercepted=%lld\"", px->fe_counters.intercepted_req);
 				}
 
@@ -2579,6 +2583,10 @@
 				chunk_appendf(&trash, "%lld,%lld,%lld,",
 			              px->fe_counters.comp_in, px->fe_counters.comp_out, px->fe_counters.comp_byp);
 
+				/* compression: comp_rsp */
+				chunk_appendf(&trash, "%lld,",
+			              px->fe_counters.p.http.comp_rsp);
+
 				/* finish with EOL */
 				chunk_appendf(&trash, "\n");
 			}
@@ -2708,6 +2716,8 @@
 				     ",,,"
 				     /* errors: cli_aborts, srv_aborts */
 				     ",,"
+				     /* compression: in, out, bypassed, comp_rsp */
+				     ",,,,"
 				     "\n",
 				     px->id, l->name,
 				     l->nbconn, l->counters->conn_max,
@@ -3126,6 +3136,9 @@
 				chunk_appendf(&trash, "%lld,%lld,",
 					     sv->counters.cli_aborts, sv->counters.srv_aborts);
 
+				/* compression: in, out, bypassed, comp_rsp */
+				chunk_appendf(&trash, ",,,,");
+
 				/* finish with EOL */
 				chunk_appendf(&trash, "\n");
 			}
@@ -3195,12 +3208,16 @@
 				if (px->mode == PR_MODE_HTTP) {
 					int i;
 
-					chunk_appendf(&trash, " title=\"rsp codes:");
+					chunk_appendf(&trash, " title=\"%lld requests:", px->be_counters.p.http.cum_req);
 
 					for (i = 1; i < 6; i++)
 						chunk_appendf(&trash, " %dxx=%lld", i, px->be_counters.p.http.rsp[i]);
 
-					chunk_appendf(&trash, " other=%lld\"", px->be_counters.p.http.rsp[0]);
+					chunk_appendf(&trash, " other=%lld ", px->be_counters.p.http.rsp[0]);
+					chunk_appendf(&trash, " compressed=%lld (%d%%)\"",
+					              px->be_counters.p.http.comp_rsp,
+					              px->be_counters.p.http.cum_req ?
+					              (int)(100*px->be_counters.p.http.comp_rsp/px->be_counters.p.http.cum_req) : 0);
 				}
 
 				chunk_appendf(&trash,
@@ -3338,6 +3355,10 @@
 				chunk_appendf(&trash, "%lld,%lld,%lld,",
 			              px->be_counters.comp_in, px->be_counters.comp_out, px->be_counters.comp_byp);
 
+				/* compression: comp_rsp */
+				chunk_appendf(&trash, "%lld,",
+			              px->be_counters.p.http.comp_rsp);
+
 				/* finish with EOL */
 				chunk_appendf(&trash, "\n");
 
diff --git a/src/proto_http.c b/src/proto_http.c
index aea1ec2..19ddbec 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -4027,12 +4027,18 @@
 		if (n < 1 || n > 5)
 			n = 0;
 
-		if (s->fe->mode == PR_MODE_HTTP)
+		if (s->fe->mode == PR_MODE_HTTP) {
 			s->fe->fe_counters.p.http.rsp[n]++;
-
+			if (s->comp_algo)
+				s->fe->fe_counters.p.http.comp_rsp++;
+		}
 		if ((s->flags & SN_BE_ASSIGNED) &&
-		    (s->be->mode == PR_MODE_HTTP))
+		    (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)
+				s->be->be_counters.p.http.comp_rsp++;
+		}
 	}
 
 	/* don't count other requests' data */
diff --git a/src/session.c b/src/session.c
index 0a07056..9aac91d 100644
--- a/src/session.c
+++ b/src/session.c
@@ -2433,12 +2433,18 @@
 		if (n < 1 || n > 5)
 			n = 0;
 
-		if (s->fe->mode == PR_MODE_HTTP)
+		if (s->fe->mode == PR_MODE_HTTP) {
 			s->fe->fe_counters.p.http.rsp[n]++;
-
+			if (s->comp_algo)
+				s->fe->fe_counters.p.http.comp_rsp++;
+		}
 		if ((s->flags & SN_BE_ASSIGNED) &&
-		    (s->be->mode == PR_MODE_HTTP))
+		    (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)
+				s->be->be_counters.p.http.comp_rsp++;
+		}
 	}
 
 	/* let's do a final log if we need it */