BUG/MEDIUM: mux-h2: Emit an error if the response chunk formatting is incomplete

In legacy HTTP mode, when an chunked H1 response is parsed before sending it to
the client, if a chunk size or a chunk CRLF is incomplete, an error is now
triggered and an RST_STREAM is sent to the client with the ROTOCOL_ERROR error
code. Most of time, it doesn't happen because the HTTP analyzers only forward
properly/fully parsed elements. Thus incomplete chunk size, CRLF and trailers
are not forwarded, waiting for more data. But if the server closes the
connection at this step, the remaining incomplete data are unconditionally
forwarded. When it happens, without this patch, in the H2 multiplexer, nothing
is parsed, leading to a infinite loop in the h2_snd_buf() function.

The HTTP trailers are not supported in legacy mode, but for completeness, the
same is done for incomplete trailers.

This patch should fix the issue #768. It must be backported as far as 1.8. On
the 1.9, an infinite loop may also be experienced. But on the 1.8, the stream is
just finished with an empty DATA frame and the server error is ignored. There is
no mainline commit ID because, on the 2.1 and above, the legacy HTTP mode no
longer exists.
1 file changed