]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: filter: Disable auto-close on channel during TCP payload filtering
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 30 Jul 2026 14:20:44 +0000 (16:20 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 30 Jul 2026 18:41:16 +0000 (20:41 +0200)
While a filter is registered on the payload filter in TCP, it is important
to disable the auto-cloes on the corresponding channel. It is already
performed in HTTP. It is only an issue when the ->tcp_payload callback
function is defined.

Without this patch, the data blocked in a filter may be lost when the
producer shut its connection. In that case, we must take care to wait the
filter flushes pending data.

This patch should fix the issue #3457. It must be backported to all
supported versions.

src/filters.c

index b9edfe5f50a940d1c022a3ad768e2af8ee35f5a0..bcb311c70ded4d8ca0f9c91b1ed7662f94f3c760 100644 (file)
@@ -1329,7 +1329,15 @@ flt_xfer_data(struct stream *s, struct channel *chn, unsigned int an_bit)
 
        /* Wait for data */
        DBG_TRACE_DEVEL("waiting for more data", STRM_EV_STRM_ANA|STRM_EV_TCP_ANA|STRM_EV_FLT_ANA, s);
+
+       /* DATA filtering is not finished and some data may still be blocked in
+        * the channel. So take care to disable auto close
+        */
+       if (HAS_DATA_FILTERS(s, chn))
+               channel_dont_close(chn);
+
        return 0;
+
  end:
        /* Terminate the data filtering. If <ret> is negative, an error was
         * encountered during the filtering. */