summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2014-02-26 16:48:33 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-28 03:17:11 +0100
commit1e29bf5b07ef60b8a8c14915bc3bcce4209b04ef (patch)
tree96afa28db92d9d7c5dbaf44038836809f951df4e
parentf8c5dd9857211601e2ea4b704df92e240b2c3b4b (diff)
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 <phartmann@blackberry.com>
-rw-r--r--src/network/access/qspdyprotocolhandler.cpp5
1 files changed, 3 insertions, 2 deletions
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<RST_STREAM_STATUS_CODE>(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);