BUG/MEDIUM: mux-h2: Handle remaining read0 cases on partial frames
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 26 Jul 2021 10:06:53 +0000 (12:06 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 12 Aug 2021 14:50:03 +0000 (16:50 +0200)
commit404e927afd9e898d010a15c7f4f98977cf98acd7
treec63219003fb0c030bd018533ca17b60473cc704a
parent94072bdff346e376f12d0916e42989795c9f3221
BUG/MEDIUM: mux-h2: Handle remaining read0 cases on partial frames

This part was fixed several times since commit aade4edc1 ("BUG/MEDIUM:
mux-h2: Don't handle pending read0 too early on streams") and there are
still some cases where a read0 event may be ignored because a partial frame
inhibits the event.

Here, we must take care to set H2_CF_END_REACHED flag if a read0 was
received while a partial frame header is received or if the padding length
is missing.

To ease partial frame detection, H2_CF_DEM_SHORT_READ flag is introduced. It
is systematically removed when some data are received and is set when a
partial frame is found or when dbuf buffer is empty. At the end of the
demux, if the connection must be closed ASAP or if data are missing to move
forward, we may acknowledge the pending read0 event, if any. For now,
H2_CF_DEM_SHORT_READ is not part of H2_CF_DEM_BLOCK_ANY mask.

This patch should fix the issue #1328. It must be backported as far as 2.0.

(cherry picked from commit b5f7b52968b617ce527f307089ec1c42ffeeab03)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit a9cc1e8b51400642450d7e47acd90dd01c01f903)
[wt: small context adjustments]
Signed-off-by: Willy Tarreau <w@1wt.eu>
src/mux_h2.c