1From: Krzysztof Oledzki <ole@ans.pl>
2Date: Sun, 20 Apr 2008 22:19:09 +0200 (CEST)
3Subject: Re: [PATCH]  Flush buffers also where there are exactly 0 bytes left
4
5I'm also attaching a debug patch that helps to trigger this bug.
6
7Without the fix:
8# echo -ne "GET /haproxy?stats;csv;norefresh HTTP/1.0\r\n\r\n"|nc 127.0.0.1=
9 801|wc -c
1016384
11
12With the fix:
13# echo -ne "GET /haproxy?stats;csv;norefresh HTTP/1.0\r\n\r\n"|nc 127.0.0.1=
14 801|wc -c
1533089
16
17Best regards,
18
19diff --git a/src/dumpstats.c b/src/dumpstats.c
20index ddadddd..28bbfce 100644
21--- a/src/dumpstats.c
22+++ b/src/dumpstats.c
23@@ -593,6 +593,7 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
24
25 	msg.len = 0;
26 	msg.str = trash;
27+	int i;
28
29 	switch (s->data_ctx.stats.px_st) {
30 	case DATA_ST_PX_INIT:
31@@ -667,6 +668,13 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
32 		/* print the frontend */
33 		if ((px->cap & PR_CAP_FE) &&
34 		    (!(s->data_ctx.stats.flags & STAT_BOUND) || (s->data_ctx.stats.type & (1 << STATS_TYPE_FE)))) {
35+
36+			if (1) {
37+				for (i=0; i<16096; i++)
38+					chunk_printf(&msg, trashlen, "*");
39+
40+				chunk_printf(&msg, trashlen, "\n");
41+#if 0
42 			if (!(s->data_ctx.stats.flags & STAT_FMT_CSV)) {
43				chunk_printf(&msg, trashlen,
44 				     /* name, queue */
45@@ -694,6 +702,7 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
46 				     px->failed_req,
47 				     px->state == PR_STRUN ? "OPEN" :
48 				     px->state == PR_STIDLE ? "FULL" : "STOP");
49+#endif
50 			} else {
51				chunk_printf(&msg, trashlen,
52 				     /* pxid, name, queue cur, queue max, */
53
54
55