summaryrefslogtreecommitdiffstats
path: root/src/network/access/qhttpnetworkconnection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/access/qhttpnetworkconnection.cpp')
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index 7755721..d53f93d 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -137,7 +137,9 @@ int QHttpNetworkConnectionPrivate::indexOf(QAbstractSocket *socket) const
for (int i = 0; i < channelCount; ++i)
if (channels[i].socket == socket)
return i;
- return -1;
+
+ qFatal("Called with unknown socket object.");
+ return 0;
}
bool QHttpNetworkConnectionPrivate::isSocketBusy(QAbstractSocket *socket) const
@@ -517,7 +519,7 @@ void QHttpNetworkConnectionPrivate::receiveReply(QAbstractSocket *socket, QHttpN
// try to reconnect/resend before sending an error.
if (channels[i].reconnectAttempts-- > 0) {
resendCurrentRequest(socket);
- } else {
+ } else if (reply) {
reply->d_func()->errorString = errorDetail(QNetworkReply::RemoteHostClosedError, socket);
emit reply->finishedWithError(QNetworkReply::RemoteHostClosedError, reply->d_func()->errorString);
QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection);
@@ -790,6 +792,7 @@ void QHttpNetworkConnectionPrivate::createAuthorization(QAbstractSocket *socket,
Q_ASSERT(socket);
int i = indexOf(socket);
+
if (channels[i].authMehtod != QAuthenticatorPrivate::None) {
if (!(channels[i].authMehtod == QAuthenticatorPrivate::Ntlm && channels[i].lastStatus != 401)) {
QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(channels[i].authenticator);
@@ -1324,7 +1327,8 @@ void QHttpNetworkConnectionPrivate::_q_encrypted()
QAbstractSocket *socket = qobject_cast<QAbstractSocket*>(q->sender());
if (!socket)
return; // ### error
- channels[indexOf(socket)].state = IdleState;
+ int i = indexOf(socket);
+ channels[i].state = IdleState;
sendRequest(socket);
}