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)
committerWilly Tarreau <w@1wt.eu>
Tue, 31 Mar 2020 14:52:57 +0000 (16:52 +0200)
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.

(cherry picked from commit 81340d7b533ac24cb791fbebede4f7bb36a9f007)
Signed-off-by: Willy Tarreau <w@1wt.eu>

src/filters.c

index c4601fe..e275050 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 */