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. Pick-to: 6.7 Change-Id: Ie7b3a45729a78106da1d8c058e15705cc7dcc53b Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>bb10
parent
b9cb2f30f1
commit
1d03e1851b
|
|
@ -1245,8 +1245,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);
|
||||
|
|
|
|||
|
|
@ -296,6 +296,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 };
|
||||
|
|
@ -313,6 +314,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…
Reference in New Issue