BUG/MEDIUM: filters: Forward all filtered data at the end of http filtering

When http filtering ends, if there are some filtered data not forwarded yet, we
forward them, in flt_http_end(). Most of time, this doesn't happen, except when
a tunnel is established using a CONNECT. In this case, there is not EOM on the
request and there is no body. Thus the headers are never forwarded, blocking the
stream.

This patch must be backported as far as 2.0. Prior versions don't suffer of this
bug because there is no HTX support. On the 2.0, the change is only applicable
on HTX streams. A special test must be performed to make sure.

(cherry picked from commit 22fca1f2c84334096e38d78ffc674be19c3e0292)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 44ba5dbe6ee29b7c37630bca57a2f2c1fd1daa35)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 4986f0fbc882c132a174464c7a12314ca9f48846)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit b1411cd7ad2f07754c3b2f6eb5fd36701decc2f8)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/filters.c b/src/filters.c
index 7562f45..8845343 100644
--- a/src/filters.c
+++ b/src/filters.c
@@ -656,15 +656,24 @@
 int
 flt_http_end(struct stream *s, struct http_msg *msg)
 {
+	unsigned long long *strm_off = &FLT_STRM_OFF(s, msg->chn);
+	unsigned int offset = 0;
 	int ret = 1;
 
 	RESUME_FILTER_LOOP(s, msg->chn) {
+		unsigned long long flt_off = FLT_OFF(filter, msg->chn);
+		offset = flt_off - *strm_off;
+
 		if (FLT_OPS(filter)->http_end) {
 			ret = FLT_OPS(filter)->http_end(s, filter, msg);
 			if (ret <= 0)
 				BREAK_EXECUTION(s, msg->chn, end);
 		}
 	} RESUME_FILTER_END;
+
+	c_adv(msg->chn, offset);
+	*strm_off += offset;
+
 end:
 	return ret;
 }