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.
This commit is contained in:
Willy Tarreau 2022-03-17 17:10:36 +01:00 committed by Christopher Faulet
parent 2ec39ea653
commit 99bbdbcc21
1 changed files with 1 additions and 1 deletions

View File

@ -2989,7 +2989,7 @@ static int h1_process(struct h1c * h1c)
h1s->flags |= H1S_F_REOS; h1s->flags |= H1S_F_REOS;
TRACE_STATE("read0 on connection", H1_EV_H1C_RECV, conn, h1s); 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; h1s->cs->flags |= CS_FL_ERROR;
TRACE_POINT(H1_EV_STRM_WAKE, h1c->conn, h1s); TRACE_POINT(H1_EV_STRM_WAKE, h1c->conn, h1s);
h1_alert(h1s); h1_alert(h1s);