]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-h1: Don't handle subscribe for reads in h1_process_demux()
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 5 Oct 2022 06:39:14 +0000 (08:39 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 17 Nov 2022 13:33:14 +0000 (14:33 +0100)
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().

src/mux_h1.c

index ebda92c0266ee0381074c6f777c631b6efa2c7af..1a6bfb8e112236cb55e5245ada3f31ed758008e7 100644 (file)
@@ -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);