]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: h2: automatically set CS_FL_RCV_MORE when the output buffer is full
authorWilly Tarreau <w@1wt.eu>
Sun, 10 Dec 2017 20:28:43 +0000 (21:28 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 10 Dec 2017 20:28:43 +0000 (21:28 +0100)
If we can't demux pending data due to a stream buffer full condition, we
now set CS_FL_RCV_MORE on the conn_stream so that the stream layer knows
it must call back as soon as possible to restart demuxing. Without this,
some uploaded payloads are truncated if the server does not consume them
fast enough and buffers fill up.

Note that this is still not enough to solve the problem, some changes are
required on the recv() and update_poll() paths to allow to restart reading
even with a buffer full condition.

This patch must be backported to 1.8.

src/mux_h2.c

index c961c015d4c600afae9a6796f416d68a61c1363f..7109c65af223bc62657a6f96ecce44ae10603983 100644 (file)
@@ -2611,6 +2611,8 @@ static int h2_frt_transfer_data(struct h2s *h2s, struct buffer *buf, int count)
        unsigned int padlen = 0;
        int offset = 0;
 
+       h2s->cs->flags &= ~CS_FL_RCV_MORE;
+
        if (h2c->dbuf->i < flen)
                return 0;
 
@@ -2631,6 +2633,7 @@ static int h2_frt_transfer_data(struct h2s *h2s, struct buffer *buf, int count)
        /* does it fit in output buffer or should we wait ? */
        if (buf->i + buf->o + flen > buf->size) {
                h2c->flags |= H2_CF_DEM_SFULL;
+               h2s->cs->flags |= CS_FL_RCV_MORE;
                return 0;
        }