]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: mux-h2: Only Report H2C error on read error if demux buffer is empty
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 18 Dec 2023 17:09:25 +0000 (18:09 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 18 Dec 2023 20:15:32 +0000 (21:15 +0100)
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.

src/mux_h2.c

index cdd1e3eaeb8063c7cd0a1c92be8f3e8fb2475187..a0f5cd5545a4d769402711e5997a2c086eb0604b 100644 (file)
@@ -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;
        }