Http2: RST: Also checking peer stream IDs for idleness

A peer can send a RST_STREAM frame for their own stream, so we have to
check if one such stream has been active instead of just our own.

Change-Id: I5a46b10df98809ed3d803bfb1a92a45ab7f7d961
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 0026b17eff313a0bb248a8d04593eb80f16f315d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Mårten Nordheim 2024-06-14 15:38:11 +02:00 committed by Qt Cherry-pick Bot
parent 61ae6f1c8a
commit c861e01300

View File

@ -1329,8 +1329,12 @@ void QHttp2Connection::handleRST_STREAM()
return;
}
// Anything greater than m_nextStreamID has not been started yet.
if (streamID >= m_nextStreamID) {
// Verify that whatever stream is being RST'd is not in the idle state:
const quint32 lastRelevantStreamID = [this, streamID]() {
quint32 peerMask = m_connectionType == Type::Client ? 0 : 1;
return ((streamID & 1) == peerMask) ? m_lastIncomingStreamID : m_nextStreamID - 2;
}();
if (streamID > lastRelevantStreamID) {
// "RST_STREAM frames MUST NOT be sent for a stream
// in the "idle" state. .. the recipient MUST treat this
// as a connection error (Section 5.4.1) of type PROTOCOL_ERROR."