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.

Pick-to: 6.8
Task-number: QTBUG-122458
Change-Id: I1a052b1f4fc80aa73fad4fc18e3c063fb738ae4e
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Lena Biliaieva 2024-07-01 14:57:41 +02:00
parent 23877db563
commit 10b7b7fcf0

View File

@ -1575,6 +1575,9 @@ void QHttp2Connection::handleCONTINUATION()
if (continuedFrames.empty())
return connectionError(PROTOCOL_ERROR,
"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())
return connectionError(PROTOCOL_ERROR, "CONTINUATION on invalid stream");