From 19fb19976f21a370fb20f528e0e570fd1a300f38 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Mon, 18 Dec 2023 18:09:25 +0100 Subject: [PATCH] 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. --- src/mux_h2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } -- 2.39.5