From 147e18f9d8bd14679cb7f459eea0263c2c1544e6 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Thu, 23 Mar 2023 17:29:47 +0100 Subject: [PATCH] BUG/MINOR: mux-h1: Properly report EOI/ERROR on read0 in h1_rcv_pipe() In h1_rcv_pipe(), only the end of stream was reported when a read0 was detected. However, it is also important to report the end of input or an error, depending on the message state. This patch does not fix any real issue for now, but some others, specific to the 2.8, rely on it. No backport needed. --- src/mux_h1.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/mux_h1.c b/src/mux_h1.c index e277e8f..f6d385b 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -3849,6 +3849,18 @@ static int h1_rcv_pipe(struct stconn *sc, struct pipe *pipe, unsigned int count) end: if (conn_xprt_read0_pending(h1c->conn)) { se_fl_set(h1s->sd, SE_FL_EOS); + TRACE_STATE("report EOS to SE", H1_EV_STRM_RECV, h1c->conn, h1s); + if (h1m->state >= H1_MSG_DONE || !(h1m->flags & H1_MF_XFER_LEN)) { + /* DONE or TUNNEL or SHUTR without XFER_LEN, set + * EOI on the stream connector */ + se_fl_set(h1s->sd, SE_FL_EOI); + TRACE_STATE("report EOI to SE", H1_EV_STRM_RECV, h1c->conn, h1s); + } + else { + se_fl_set(h1s->sd, SE_FL_ERROR); + h1c->flags = (h1c->flags & ~H1C_F_WANT_SPLICE) | H1C_F_ERROR; + TRACE_ERROR("message aborted, set error on SC", H1_EV_STRM_RECV|H1_EV_H1S_ERR, h1c->conn, h1s); + } h1c->flags = (h1c->flags & ~H1C_F_WANT_SPLICE) | H1C_F_EOS; TRACE_STATE("Allow xprt rcv_buf on read0", H1_EV_STRM_RECV, h1c->conn, h1s); } -- 1.7.10.4