From: Willy Tarreau Date: Sun, 10 Dec 2017 20:28:43 +0000 (+0100) Subject: BUG/MEDIUM: h2: automatically set CS_FL_RCV_MORE when the output buffer is full X-Git-Tag: v1.9-dev1~592 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c9ede6c43e40b255d7caa22c41a6790314699dc1;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: h2: automatically set CS_FL_RCV_MORE when the output buffer is full 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. --- diff --git a/src/mux_h2.c b/src/mux_h2.c index c961c015d4..7109c65af2 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -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; }