BUG/MEDIUM: mux_h2: Handle others remaining read0 cases on partial frames
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 8 Oct 2021 06:56:00 +0000 (08:56 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 19 Oct 2021 13:55:43 +0000 (15:55 +0200)
commit0bf718040d761142bed09f9f5423468d2106cd87
treeb49e9bb2126235a90c8ff57a70719cf286457f7e
parent6b6e5e09ac857b953a9dd5461a4e3a5c52c72e20
BUG/MEDIUM: mux_h2: Handle others remaining read0 cases on partial frames

We've found others places where the read0 is ignored because of an
incomplete frame parsing. This time, it happens during parsing of
CONTINUATION frames.

When frames are parsed, incomplete frames are properly handled and
H2_CF_DEM_SHORT_READ flag is set. It is also true for HEADERS
frames. However, for CONTINUATION frames, there is an exception. Besides
parsing the current frame, we try to peek header of the next one to merge
payload of both frames, the current one and the next one. Idea is to create
a sole HEADERS frame before parsing the payload. However, in this case, it
is possible to have an incomplete frame too, not the current one but the
next one. From the demux point of view, the current frame is complete. We
must go to the internal function h2c_decode_headers() to detect an
incomplete frame. And this case was not identified and fixed when
H2_CF_DEM_SHORT_READ flag was introduced in the commit b5f7b5296
("BUG/MEDIUM: mux-h2: Handle remaining read0 cases on partial frames")

This bug was reported in a comment of the issue #1362. The patch must be
backported as far as 2.0.

(cherry picked from commit 485da0b0535cc575ed8d4f3bf407e9101dbb80aa)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 0de3f552a4e19fa28b2beb9dc90f8aa6b9e1fd62)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/mux_h2.c