From: Christopher Faulet Date: Mon, 18 Dec 2023 17:09:25 +0000 (+0100) Subject: BUG/MEDIUM: mux-h2: Only Report H2C error on read error if demux buffer is empty X-Git-Tag: v3.0-dev1~87 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=19fb19976f;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/mux_h2.c b/src/mux_h2.c index cdd1e3eaeb..a0f5cd5545 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -3959,7 +3959,7 @@ static int h2_recv(struct h2c *h2c) TRACE_DATA("received read0", H2_EV_H2C_RECV, h2c->conn); 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); h2c->flags |= H2_CF_ERROR; }