From: Christopher Faulet Date: Fri, 16 Dec 2022 09:43:11 +0000 (+0100) Subject: BUG/MINOR: mux-h1: Report EOS on parsing/internal error for not running stream X-Git-Tag: v2.8-dev1~106 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=75028f83d4329740fa7b718f248b6312f48bc01e;p=thirdparty%2Fhaproxy.git BUG/MINOR: mux-h1: Report EOS on parsing/internal error for not running stream When an error occurred during the request parsing while the stream is not running, an EOS must be reported. It is not an issue for an embryonic connection because the H1 stream is orphan. However, it is an issue with connections upgraded from TCP to H1. In this case, the upgrade is not performed because there is an early error. However the H1 stream is not orphan and is not destroyed. The H1 multiplexer will wait for the detach event. But without EOS, the upper layer is unable to perform the shutdown. This patch is related to #1966. It must be backported to 2.7. Older versions are not affected by this issue. --- diff --git a/src/mux_h1.c b/src/mux_h1.c index fb1363bc00..bade6e2018 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -1920,6 +1920,10 @@ static size_t h1_process_demux(struct h1c *h1c, struct buffer *buf, size_t count err: htx_to_buf(htx, buf); se_fl_set(h1s->sd, SE_FL_EOI); + if (h1c->state < H1_CS_RUNNING) { + h1c->flags |= H1C_F_EOS; + se_fl_set(h1s->sd, SE_FL_EOS); + } TRACE_DEVEL("leaving on error", H1_EV_RX_DATA|H1_EV_STRM_ERR, h1c->conn, h1s); return 0; }