]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: mux-h1: Don't read data from a pipe if the mux is unable to receive
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 3 Jul 2020 13:02:25 +0000 (15:02 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 7 Jul 2020 12:29:18 +0000 (14:29 +0200)
In h1_rcv_pipe(), if the mux is unable to receive data, for instance because the
multiplexer is blocked on input waiting the other side (BUSY mode), no receive
must be performed.

This patch must be backported to 2.1 and 2.0.

src/mux_h1.c

index a6dffeb09daaea2f10e18754ef06a0980ce2c82b..7aa448c2b6afa88ab4dd881491a04c579c76f766 100644 (file)
@@ -2781,6 +2781,12 @@ static int h1_rcv_pipe(struct conn_stream *cs, struct pipe *pipe, unsigned int c
        h1s->flags &= ~H1S_F_BUF_FLUSH;
        h1s->flags |= H1S_F_SPLICED_DATA;
        TRACE_STATE("enable splicing", H1_EV_STRM_RECV, cs->conn, h1s);
+
+       if (!h1_recv_allowed(h1s->h1c)) {
+               TRACE_DEVEL("leaving on !recv_allowed", H1_EV_STRM_RECV, cs->conn, h1s);
+               goto end;
+       }
+
        if (h1m->state == H1_MSG_DATA && count > h1m->curr_len)
                count = h1m->curr_len;
        ret = cs->conn->xprt->rcv_pipe(cs->conn, cs->conn->xprt_ctx, pipe, count);