From: Christopher Faulet Date: Wed, 5 Oct 2022 06:39:14 +0000 (+0200) Subject: MINOR: mux-h1: Don't handle subscribe for reads in h1_process_demux() X-Git-Tag: v2.7-dev9~31 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2177d96acd615af41932003c503b1a1f185ae088;p=thirdparty%2Fhaproxy.git MINOR: mux-h1: Don't handle subscribe for reads in h1_process_demux() When the request headers are not fully received, we must subscribe the H1 connection for reads to be able to receive more data. This was performed in h1_process_demux(). It is now perfoemd in h1_process_demux(). --- diff --git a/src/mux_h1.c b/src/mux_h1.c index ebda92c026..1a6bfb8e11 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -1836,6 +1836,9 @@ static size_t h1_process_demux(struct h1c *h1c, struct buffer *buf, size_t count if (!b_data(&h1c->ibuf)) h1_release_buf(h1c, &h1c->ibuf); + if (h1m->state <= H1_MSG_LAST_LF) + goto out; + if (h1c->state < H1_CS_RUNNING) { /* The H1 connection is not ready. Most of time, there is no SC * attached, except for TCP>H1 upgrade, from a TCP frontend. In both @@ -1843,12 +1846,6 @@ static size_t h1_process_demux(struct h1c *h1c, struct buffer *buf, size_t count */ BUG_ON(h1c->flags & H1C_F_IS_BACK); - if (h1m->state <= H1_MSG_LAST_LF) { - TRACE_STATE("Incomplete message, subscribing", H1_EV_RX_DATA|H1_EV_H1C_BLK|H1_EV_H1C_WAKE, h1c->conn, h1s); - h1c->conn->xprt->subscribe(h1c->conn, h1c->conn->xprt_ctx, SUB_RETRY_RECV, &h1c->wait_event); - goto end; - } - if (h1c->state == H1_CS_EMBRYONIC) { TRACE_DEVEL("request headers fully parsed, create and attach the SC", H1_EV_RX_DATA, h1c->conn, h1s); BUG_ON(h1s_sc(h1s)); @@ -2988,6 +2985,10 @@ static int h1_process(struct h1c * h1c) h1c->flags = (h1c->flags & ~H1C_F_WAIT_NEXT_REQ) | H1C_F_ERROR; TRACE_ERROR("parsing error detected", H1_EV_H1C_WAKE|H1_EV_H1C_ERR); } + else if (h1c->state < H1_CS_RUNNING) { + TRACE_STATE("Incomplete message, subscribing", H1_EV_RX_DATA|H1_EV_H1C_BLK|H1_EV_H1C_WAKE, h1c->conn, h1s); + h1c->conn->xprt->subscribe(h1c->conn, h1c->conn->xprt_ctx, SUB_RETRY_RECV, &h1c->wait_event); + } } h1_send(h1c);