BUG/MINOR: mux-h1: Be sure to only set CO_RFL_READ_ONCE for the first read
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 21 Sep 2020 09:59:21 +0000 (11:59 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 7 Oct 2020 12:07:29 +0000 (14:07 +0200)
The condition to set CO_RFL_READ_ONCE flag is not really accurate. We must check
the request state on frontend connection only and, in the opposite, the response
state on backend connection only. Only the parsed side must be considered, not
the opposite one.

This patch must be backported to 2.2.

src/mux_h1.c

index 5d2b770..9091159 100644 (file)
@@ -2061,7 +2061,8 @@ static int h1_recv(struct h1c *h1c)
                b_slow_realign(&h1c->ibuf, trash.area, 0);
 
        /* avoid useless reads after first responses */
-       if (h1s && (h1s->req.state == H1_MSG_RQBEFORE || h1s->res.state == H1_MSG_RPBEFORE))
+       if (h1s && ((!conn_is_back(conn) && h1s->req.state == H1_MSG_RQBEFORE) ||
+                   (conn_is_back(conn) && h1s->res.state == H1_MSG_RPBEFORE)))
                flags |= CO_RFL_READ_ONCE;
 
        max = buf_room_for_htx_data(&h1c->ibuf);