From: Willy Tarreau Date: Thu, 17 Mar 2022 16:10:36 +0000 (+0100) Subject: BUG/MEDIUM: mux-h1: only turn CO_FL_ERROR to CS_FL_ERROR with empty ibuf X-Git-Tag: v2.6-dev4~54 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=99bbdbcc2;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: mux-h1: only turn CO_FL_ERROR to CS_FL_ERROR with empty ibuf 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. --- diff --git a/src/mux_h1.c b/src/mux_h1.c index 3ddf6ef865..3e2ea2655e 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -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);