Skip to content

Commit

Permalink
Http2: RST: Also checking peer stream IDs for idleness
Browse files Browse the repository at this point in the history
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.

Pick-to: 6.8
Change-Id: I5a46b10df98809ed3d803bfb1a92a45ab7f7d961
Reviewed-by: Øystein Heskestad <[email protected]>
Reviewed-by: Timur Pocheptsov <[email protected]>
  • Loading branch information
Morten242 committed Jul 26, 2024
1 parent 00f4e48 commit 0026b17
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/network/access/qhttp2connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1348,8 +1348,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."
Expand Down

0 comments on commit 0026b17

Please sign in to comment.