]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: mux-h1: Don't block reads when waiting for the other side
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 8 Apr 2021 16:34:30 +0000 (18:34 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 6 May 2021 07:19:06 +0000 (09:19 +0200)
When we are waiting for the other side to read more data, or to read the
next request, we must only stop the processing of input data and not the
data receipt. This patch don't change anything on the subscribes for
reads. So it should not change anything. The only difference is that the H1
connection will try to read data if it is woken up for an I/O event and if
it was subscribed for reads.

This patch is required to fix abortonclose option for H1 client connections.

src/mux_h1.c

index 62bd4771d81e237d7b80c8df4990d9465b07c60b..b16f52a7adf0a79859d73a449bf897dd5b9d6324 100644 (file)
@@ -393,11 +393,6 @@ static inline int h1_recv_allowed(const struct h1c *h1c)
                return 0;
        }
 
-       if (h1c->flags & H1C_F_WAIT_OUTPUT) {
-               TRACE_DEVEL("recv not allowed (wait_output)", H1_EV_H1C_RECV|H1_EV_H1C_BLK, h1c->conn);
-               return 0;
-       }
-
        if (!(h1c->flags & (H1C_F_IN_ALLOC|H1C_F_IN_FULL|H1C_F_IN_SALLOC)))
                return 1;
 
@@ -1538,7 +1533,7 @@ static size_t h1_process_input(struct h1c *h1c, struct buffer *buf, size_t count
                goto end;
 
        if (h1c->flags & H1C_F_WAIT_OUTPUT)
-               goto end;
+               goto out;
 
        do {
                size_t used = htx_used_space(htx);
@@ -1698,6 +1693,7 @@ static size_t h1_process_input(struct h1c *h1c, struct buffer *buf, size_t count
            ((h1m->state == H1_MSG_DONE) && (h1s->meth != HTTP_METH_CONNECT) && !(h1m->flags & H1_MF_CONN_UPG)))
                h1s->cs->flags |= CS_FL_EOI;
 
+  out:
        if (h1s_data_pending(h1s) && !htx_is_empty(htx))
                h1s->cs->flags |= CS_FL_RCV_MORE | CS_FL_WANT_ROOM;
        else {