]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: mux-h1: only turn CO_FL_ERROR to CS_FL_ERROR with empty ibuf
authorWilly Tarreau <w@1wt.eu>
Thu, 17 Mar 2022 16:10:36 +0000 (17:10 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 18 Mar 2022 16:00:17 +0000 (17:00 +0100)
A connection-level error must not be turned to a stream-level error if there
are still pending data for that stream, otherwise it can cause the truncation
of the last pending data.

This must be backported to affected releases, at least as far as 2.4,
maybe further.

src/mux_h1.c

index 3ddf6ef8654b27fe17ccb7f9caa327912f3a8c89..3e2ea2655ea0e7193be6560802ae1c9f74276a29 100644 (file)
@@ -2989,7 +2989,7 @@ static int h1_process(struct h1c * h1c)
                                h1s->flags |= H1S_F_REOS;
                                TRACE_STATE("read0 on connection", H1_EV_H1C_RECV, conn, h1s);
                        }
-                       if ((h1c->flags & H1C_F_ST_ERROR) || (conn->flags & CO_FL_ERROR))
+                       if ((h1c->flags & H1C_F_ST_ERROR) || ((conn->flags & CO_FL_ERROR) && !b_data(&h1c->ibuf)))
                                h1s->cs->flags |= CS_FL_ERROR;
                        TRACE_POINT(H1_EV_STRM_WAKE, h1c->conn, h1s);
                        h1_alert(h1s);