]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: filters: Forward everything if no data filters are called
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 26 Feb 2020 14:47:22 +0000 (15:47 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 6 Mar 2020 13:12:59 +0000 (14:12 +0100)
If a filter enable the data filtering, in TCP or in HTTP, but it does not
defined the corresponding callback function (so http_payload() or
tcp_payload()), it will be ignored. If all configured data filter do the same,
we must be sure to forward everything. Otherwise nothing will be forwarded at
all.

This patch must be forwarded as far as 1.9.

src/filters.c

index c4601febe7a2cc1653799192c57d2c6acbe3955c..e2750504080e1ab3b7e688bee1fb6437298dad93 100644 (file)
@@ -611,8 +611,9 @@ flt_http_payload(struct stream *s, struct http_msg *msg, unsigned int len)
        struct filter *filter;
        unsigned long long *strm_off = &FLT_STRM_OFF(s, msg->chn);
        unsigned int out = co_data(msg->chn);
-       int ret = 0, data = len - out;
+       int ret, data;
 
+       ret = data = len - out;
        DBG_TRACE_ENTER(STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA|STRM_EV_FLT_ANA, s, s->txn, msg);
        list_for_each_entry(filter, &strm_flt(s)->filters, list) {
                /* Call "data" filters only */
@@ -875,8 +876,9 @@ flt_tcp_payload(struct stream *s, struct channel *chn, unsigned int len)
        struct filter *filter;
        unsigned long long *strm_off = &FLT_STRM_OFF(s, chn);
        unsigned int out = co_data(chn);
-       int ret = 0, data = len - out;
+       int ret, data;
 
+       ret = data = len - out;
        DBG_TRACE_ENTER(STRM_EV_TCP_ANA|STRM_EV_FLT_ANA, s);
        list_for_each_entry(filter, &strm_flt(s)->filters, list) {
                /* Call "data" filters only */