From 1e29bf5b07ef60b8a8c14915bc3bcce4209b04ef Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 26 Feb 2014 16:48:33 +0100 Subject: Do not assume nice behavior in error handling SPDY is currently assuming it will only receive RST_STREAM messages on active steams. This is however not always a safe assumption. Task-number: QTBUG-37100 Change-Id: Ied89a68a209891992ad72daa513066efc1d7c421 Reviewed-by: Peter Hartmann --- src/network/access/qspdyprotocolhandler.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/network/access') diff --git a/src/network/access/qspdyprotocolhandler.cpp b/src/network/access/qspdyprotocolhandler.cpp index d9d861f9b4..098b3e9ab0 100644 --- a/src/network/access/qspdyprotocolhandler.cpp +++ b/src/network/access/qspdyprotocolhandler.cpp @@ -959,7 +959,6 @@ void QSpdyProtocolHandler::handleRST_STREAM(char /*flags*/, quint32 length, Q_UNUSED(length); // silence -Wunused-parameter qint32 streamID = getStreamID(frameData.constData()); QHttpNetworkReply *httpReply = m_inFlightStreams.value(streamID).second; - Q_ASSERT(httpReply); qint32 statusCodeInt = fourBytesToInt(frameData.constData() + 4); RST_STREAM_STATUS_CODE statusCode = static_cast(statusCodeInt); @@ -1016,7 +1015,8 @@ void QSpdyProtocolHandler::handleRST_STREAM(char /*flags*/, quint32 length, errorCode = QNetworkReply::ProtocolFailure; errorMessage = "got SPDY RST_STREAM message with unknown error code"; } - replyFinishedWithError(httpReply, streamID, errorCode, errorMessage.constData()); + if (httpReply) + replyFinishedWithError(httpReply, streamID, errorCode, errorMessage.constData()); } void QSpdyProtocolHandler::handleSETTINGS(char flags, quint32 /*length*/, const QByteArray &frameData) @@ -1266,6 +1266,7 @@ void QSpdyProtocolHandler::replyFinished(QHttpNetworkReply *httpReply, qint32 st void QSpdyProtocolHandler::replyFinishedWithError(QHttpNetworkReply *httpReply, qint32 streamID, QNetworkReply::NetworkError errorCode, const char *errorMessage) { + Q_ASSERT(httpReply); httpReply->d_func()->state = QHttpNetworkReplyPrivate::SPDYClosed; int streamsRemoved = m_inFlightStreams.remove(streamID); Q_ASSERT(streamsRemoved == 1); -- cgit v1.2.3