Fix race in http connection channel

When authentication is cancelled, close the channel instead of the
underlying socket.
The previous behaviour could result in further requests being sent
on the closed socket, which caused errors in case of https over a proxy.

Change-Id: I3dbfc164de4fb29a426c06acaac8f29b9da1d705
Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
This commit is contained in:
Shane Kearns 2011-12-19 15:35:52 +00:00 committed by Qt by Nokia
parent d24aad8289
commit a7b99151f4
2 changed files with 3 additions and 1 deletions

View File

@ -482,7 +482,6 @@ bool QHttpNetworkConnectionPrivate::handleAuthenticateChallenge(QAbstractSocket
reply->d_func()->errorString = errorDetail(errorCode, socket);
emit reply->finishedWithError(errorCode, reply->d_func()->errorString);
// ### at this point the reply could be deleted
socket->close();
return true;
}
//resend the request

View File

@ -793,6 +793,9 @@ void QHttpNetworkConnectionChannel::handleStatus()
closeAndResendCurrentRequest();
QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection);
}
} else {
//authentication cancelled, close the channel.
close();
}
} else {
emit reply->headerChanged();