QHttp2Connection: fix handling of replies on locally initiated stream
It was overlooked in testing, but it would emit a signal for new incoming stream even if the server was just replying with HEADERS on a stream the client had initiated. Or vice-versa. Change-Id: Ie7b3a45729a78106da1d8c058e15705cc7dcc53b Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit 1d03e1851bcaf80700f19c8c583e6b9abc2059a7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
0cf3244939
commit
36059bfa36
@ -910,8 +910,13 @@ void QHttp2Connection::handleHEADERS()
|
||||
if (streamID == connectionStreamID)
|
||||
return connectionError(PROTOCOL_ERROR, "HEADERS on 0x0 stream");
|
||||
|
||||
if (streamID > m_lastIncomingStreamID) {
|
||||
const bool isClient = m_connectionType == Type::Client;
|
||||
const bool isClientInitiatedStream = !!(streamID & 1);
|
||||
const bool isRemotelyInitiatedStream = isClient ^ isClientInitiatedStream;
|
||||
|
||||
if (isRemotelyInitiatedStream && streamID > m_lastIncomingStreamID) {
|
||||
QHttp2Stream *newStream = createStreamInternal_impl(streamID);
|
||||
Q_ASSERT(newStream);
|
||||
m_lastIncomingStreamID = streamID;
|
||||
qCDebug(qHttp2ConnectionLog, "[%p] Created new incoming stream %d", this, streamID);
|
||||
emit newIncomingStream(newStream);
|
||||
|
@ -266,6 +266,7 @@ void tst_QHttp2Connection::connectToServer()
|
||||
QVERIFY(waitForSettingsExchange(connection, serverConnection));
|
||||
|
||||
QSignalSpy newIncomingStreamSpy{ serverConnection, &QHttp2Connection::newIncomingStream };
|
||||
QSignalSpy clientIncomingStreamSpy{ connection, &QHttp2Connection::newIncomingStream };
|
||||
|
||||
QHttp2Stream *clientStream = connection->createStream().unwrap();
|
||||
QSignalSpy clientHeaderReceivedSpy{ clientStream, &QHttp2Stream::headersReceived };
|
||||
@ -283,6 +284,8 @@ void tst_QHttp2Connection::connectToServer()
|
||||
const HPack::HttpHeader
|
||||
headersReceived = clientHeaderReceivedSpy.front().front().value<HPack::HttpHeader>();
|
||||
QCOMPARE(headersReceived, ExpectedResponseHeaders);
|
||||
|
||||
QCOMPARE(clientIncomingStreamSpy.count(), 0);
|
||||
}
|
||||
|
||||
void tst_QHttp2Connection::WINDOW_UPDATE()
|
||||
|
Loading…
x
Reference in New Issue
Block a user