BUG/MEDIUM: mux-h2: Report too large HEADERS frame only when rxbuf is empty

During HEADERS frames decoding, if a frame is too large to fit in a buffer,
an internal error is reported and a RST_STREAM is emitted. On the other
hand, we wait to have an empty rxbuf to decode the frame because we cannot
retry a failed HPACK decompression.

When we are decoding headers, it is valid to return an error if dbuf buffer
is full because no data can be blocked in the rxbuf (which hosts the HTX
message).

However, during the trailers decoding, it is possible to have some data not
sent yet for the current stream in the rxbug and data for another stream
fully filling the dbuf buffer. In this case, we don't decode the trailers
but we must not return an error. We must wait to empty the rxbuf first.

Now, a HEADERS frame is considered as too large if the dbuf buffer is full
and if the rxbuf is empty (the HTX message to be accurate).

This patch should fix the issue #2382. It must be backported to all stable
versions.

(cherry picked from commit 682f73b4fa6d76aa0b5b743fe92777822884772d)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit 17fa5e6fc643eb2c09ccb0d794500746b3376c17)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit e3ec217d457e8ec987467a550bb139ee9924b1a4)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit bae0e62df7c4442677681dc880cdd2948ff0749c)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 888a6b97b32f11f4726d8e178d8538b7a5d43fe0)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
1 file changed