From d1023bbab3985091a9968192bb984d7724a438a3 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 22 Mar 2018 16:53:12 +0100 Subject: [PATCH] BUG/MEDIUM: h2: properly account for DATA padding in flow control Recent fixes made to process partial frames broke the flow control on DATA frames, as the padding is not considered anymore, only the actual data is. Let's simply take account of the padding once the transfer ends. The probability to meet this bug is low because, when used, padding is small and it can require a large number of padded transfers before the window is completely depleted. Thanks to user klzgrad for reporting this bug and confirming the fix. This fix must be backported to 1.8. --- src/mux_h2.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mux_h2.c b/src/mux_h2.c index ebefd5200..d15b0e33b 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -2788,6 +2788,9 @@ static int h2_frt_transfer_data(struct h2s *h2s, struct buffer *buf, int count) /* here we're done with the frame, all the payload (except padding) was * transferred. */ + h2c->rcvd_c += h2c->dpl; + h2c->rcvd_s += h2c->dpl; + h2c->dpl = 0; h2c->st0 = H2_CS_FRAME_A; // send the corresponding window update /* don't send it before returning data!