summaryrefslogtreecommitdiff
path: root/src/network/access/qhttpnetworkconnectionchannel.cpp
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-10-29 18:06:48 +0200
committerQt Continuous Integration System <qt-info@nokia.com>2010-10-29 18:06:48 +0200
commit7db218d6860a04df238735ff692010f0910d0c92 (patch)
treead8033623855b3afb17752552ca56b096c1b9159 /src/network/access/qhttpnetworkconnectionchannel.cpp
parent8943b44c38ee6244c4a5b190c2b35879b1921843 (diff)
parentc02ef9eb331f03dbd59d2fd938c53b54f5c65cea (diff)
downloadqt4-tools-7db218d6860a04df238735ff692010f0910d0c92.tar.gz
Merge branch 4.7 into qt-master-from-4.7
Diffstat (limited to 'src/network/access/qhttpnetworkconnectionchannel.cpp')
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp36
1 files changed, 16 insertions, 20 deletions
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 74c584413c..d8530ccc80 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -69,8 +69,8 @@ QHttpNetworkConnectionChannel::QHttpNetworkConnectionChannel()
, lastStatus(0)
, pendingEncrypt(false)
, reconnectAttempts(2)
- , authMehtod(QAuthenticatorPrivate::None)
- , proxyAuthMehtod(QAuthenticatorPrivate::None)
+ , authMethod(QAuthenticatorPrivate::None)
+ , proxyAuthMethod(QAuthenticatorPrivate::None)
#ifndef QT_NO_OPENSSL
, ignoreAllSslErrors(false)
#endif
@@ -189,6 +189,7 @@ bool QHttpNetworkConnectionChannel::sendRequest()
|| (!url.password().isEmpty() && url.password() != auth.password())) {
auth.setUser(url.userName());
auth.setPassword(url.password());
+ emit reply->cacheCredentials(request, &auth);
connection->d_func()->copyCredentials(connection->d_func()->indexOf(socket), &auth, false);
}
// clear the userinfo, since we use the same request for resending
@@ -308,7 +309,6 @@ bool QHttpNetworkConnectionChannel::sendRequest()
break;
}
case QHttpNetworkConnectionChannel::ReadingState:
- case QHttpNetworkConnectionChannel::Wait4AuthState:
// ignore _q_bytesWritten in these states
// fall through
default:
@@ -795,8 +795,7 @@ void QHttpNetworkConnectionChannel::handleStatus()
? QNetworkReply::ProxyAuthenticationRequiredError
: QNetworkReply::AuthenticationRequiredError;
reply->d_func()->errorString = connection->d_func()->errorDetail(errorCode, socket);
- emit connection->error(errorCode, reply->d_func()->errorString);
- emit reply->finished();
+ emit reply->finishedWithError(errorCode, reply->d_func()->errorString);
}
break;
default:
@@ -972,7 +971,6 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket
{
if (!socket)
return;
- bool send2Reply = false;
QNetworkReply::NetworkError errorCode = QNetworkReply::UnknownNetworkError;
switch (socketError) {
@@ -990,7 +988,6 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket
closeAndResendCurrentRequest();
return;
} else {
- send2Reply = true;
errorCode = QNetworkReply::RemoteHostClosedError;
}
} else {
@@ -1003,7 +1000,6 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket
closeAndResendCurrentRequest();
return;
}
- send2Reply = true;
errorCode = QNetworkReply::TimeoutError;
break;
case QAbstractSocket::ProxyAuthenticationRequiredError:
@@ -1019,18 +1015,14 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket
}
QPointer<QHttpNetworkConnection> that = connection;
QString errorString = connection->d_func()->errorDetail(errorCode, socket, socket->errorString());
- if (send2Reply) {
- if (reply) {
- reply->d_func()->errorString = errorString;
- // this error matters only to this reply
- emit reply->finishedWithError(errorCode, errorString);
- }
- // send the next request
- QMetaObject::invokeMethod(that, "_q_startNextRequest", Qt::QueuedConnection);
- } else {
- // the failure affects all requests.
- emit connection->error(errorCode, errorString);
+
+ if (reply) {
+ reply->d_func()->errorString = errorString;
+ emit reply->finishedWithError(errorCode, errorString);
}
+ // send the next request
+ QMetaObject::invokeMethod(that, "_q_startNextRequest", Qt::QueuedConnection);
+
if (that) //signal emission triggered event loop
close();
}
@@ -1061,7 +1053,11 @@ void QHttpNetworkConnectionChannel::_q_sslErrors(const QList<QSslError> &errors)
if (!socket)
return;
//QNetworkReply::NetworkError errorCode = QNetworkReply::ProtocolFailure;
- emit connection->sslErrors(errors);
+ // Also pause the connection because socket notifiers may fire while an user
+ // dialog is displaying
+ connection->d_func()->pauseConnection();
+ emit reply->sslErrors(errors);
+ connection->d_func()->resumeConnection();
}
void QHttpNetworkConnectionChannel::_q_encryptedBytesWritten(qint64 bytes)