BUG/MEDIUM: mux-h2: Only Report H2C error on read error if demux buffer is empty

It is similar to the previous fix ("BUG/MEDIUM: mux-h2: Don't report H2C
error on read error if dmux buffer is not empty"), but on receive side. If
the demux buffer is not empty, an error on the TCP connection must not be
immediately reported as an error on the H2 connection. We must be sure to
have tried to demux all data first. Otherwise, messages for one or more
streams may be truncated while all data were already received and are
waiting to be demux.

This patch is part of a series that should fix a bug reported in issue #2388
(#2388#issuecomment-1855735144). Backport instructions will be shipped in
the last commit of the series.
This commit is contained in:
Christopher Faulet 2023-12-18 18:09:25 +01:00
parent 5b78cbae77
commit 19fb19976f

View File

@ -3959,7 +3959,7 @@ static int h2_recv(struct h2c *h2c)
TRACE_DATA("received read0", H2_EV_H2C_RECV, h2c->conn); TRACE_DATA("received read0", H2_EV_H2C_RECV, h2c->conn);
h2c->flags |= H2_CF_RCVD_SHUT; h2c->flags |= H2_CF_RCVD_SHUT;
} }
if (h2c->conn->flags & CO_FL_ERROR) { if (h2c->conn->flags & CO_FL_ERROR && !b_data(&h2c->dbuf)) {
TRACE_DATA("connection error", H2_EV_H2C_RECV, h2c->conn); TRACE_DATA("connection error", H2_EV_H2C_RECV, h2c->conn);
h2c->flags |= H2_CF_ERROR; h2c->flags |= H2_CF_ERROR;
} }