QHttp2Connection: Return connection error if CONTINUATION isn't expected

According to RFC 9113: A CONTINUATION frame MUST be preceded by
a HEADERS, PUSH_PROMISE or CONTINUATION frame without the END_HEADERS
flag set. A recipient that observes violation of this rule MUST respond
with a connection error of type PROTOCOL_ERROR.

Task-number: QTBUG-122458
Change-Id: I1a052b1f4fc80aa73fad4fc18e3c063fb738ae4e
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 10b7b7fcf06d4ed5492e946ac93eb232c168e686)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Lena Biliaieva 2024-07-01 14:57:41 +02:00 committed by Qt Cherry-pick Bot
parent e90a61ca49
commit c26e16e1d4

View File

@ -1556,6 +1556,9 @@ void QHttp2Connection::handleCONTINUATION()
if (continuedFrames.empty()) if (continuedFrames.empty())
return connectionError(PROTOCOL_ERROR, return connectionError(PROTOCOL_ERROR,
"CONTINUATION without a preceding HEADERS or PUSH_PROMISE"); "CONTINUATION without a preceding HEADERS or PUSH_PROMISE");
if (!continuationExpected)
return connectionError(PROTOCOL_ERROR,
"CONTINUATION after a frame with the END_HEADERS flag set");
if (inboundFrame.streamID() != continuedFrames.front().streamID()) if (inboundFrame.streamID() != continuedFrames.front().streamID())
return connectionError(PROTOCOL_ERROR, "CONTINUATION on invalid stream"); return connectionError(PROTOCOL_ERROR, "CONTINUATION on invalid stream");