summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index 8537502116..7be9d278f7 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -1094,6 +1094,16 @@ void QNetworkAccessManagerPrivate::authenticationRequired(QAuthenticator *authen
// also called when last URL is empty, e.g. on first call
if (urlForLastAuthentication->isEmpty()
|| url != *urlForLastAuthentication) {
+ // if credentials are included in the url, then use them
+ if (!url.userName().isEmpty()
+ && !url.password().isEmpty()) {
+ authenticator->setUser(url.userName());
+ authenticator->setPassword(url.password());
+ *urlForLastAuthentication = url;
+ authenticationManager->cacheCredentials(url, authenticator);
+ return;
+ }
+
QNetworkAuthenticationCredential cred = authenticationManager->fetchCachedCredentials(url, authenticator);
if (!cred.isNull()) {
authenticator->setUser(cred.user);