]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: stconn: Don't forward channel data if input data must be filtered
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 15 Apr 2024 17:09:01 +0000 (19:09 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 16 Apr 2024 09:36:54 +0000 (11:36 +0200)
Once data are received and placed in a channel buffer, if it is possible,
outgoing data are immediately forwarded. But we must take care to not do so
if there is also pending input data and a filter registered on the
channel. It is especially important for HTX streams because the HTX may be
altered, especially the extra field. And it is indeed an issue with the HTTP
compression filter and the H1 multiplexer. The wrong chunk size may be
announced leading to an internal error.

This patch should fix the issue #2530. It must be backported to all stable
versions.

src/stconn.c

index acfa6cc3958f08fd3738fa238e294b8c50238073..7cdc9ff3048e26faa68a6e1d272d75682e902a2a 100644 (file)
@@ -14,6 +14,7 @@
 #include <haproxy/applet.h>
 #include <haproxy/connection.h>
 #include <haproxy/check.h>
+#include <haproxy/filters.h>
 #include <haproxy/http_ana.h>
 #include <haproxy/pipe.h>
 #include <haproxy/pool.h>
@@ -1102,6 +1103,7 @@ void sc_notify(struct stconn *sc)
         */
        if (sc_ep_have_ff_data(sc_opposite(sc)) ||
            (co_data(ic) && sc_ep_test(sco, SE_FL_WAIT_DATA) &&
+            (!HAS_DATA_FILTERS(__sc_strm(sc), ic) || channel_input_data(ic) == 0) &&
             (!(sc->flags & SC_FL_SND_EXP_MORE) || channel_full(ic, co_data(ic)) || channel_input_data(ic) == 0))) {
                int new_len, last_len;