summaryrefslogtreecommitdiff
path: root/src/webenginewidgets/api/qwebenginepage.cpp
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2015-08-11 17:02:17 +0200
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-09-01 11:56:02 +0000
commitf55163c647e622a47bb52d8f9e96833f2a640960 (patch)
tree970545a69cec7135435feeccd97c18baa407962e /src/webenginewidgets/api/qwebenginepage.cpp
parentd75f57fc4290e769d3f159e7fc464a6c28b867b3 (diff)
downloadqtwebengine-f55163c647e622a47bb52d8f9e96833f2a640960.tar.gz
Fix use of empty credentials for HTTP and proxy authentication
Empty user and password fields are valid for HTTP and proxy authentication. Thus it does not mean that the authentication is cancelled. For informing the engine about the cancellation of the authentication dialog make QAuthenticator instance null. Change-Id: Iba1ce9d375b9b37c23f7a91fb583606d75d04af5 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Diffstat (limited to 'src/webenginewidgets/api/qwebenginepage.cpp')
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index 503ba87d4..a4cc0ac12 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -249,7 +249,7 @@ void QWebEnginePagePrivate::passOnFocus(bool reverse)
view->focusNextPrevChild(!reverse);
}
-void QWebEnginePagePrivate::authenticationRequired(const QUrl &requestUrl, const QString &realm, bool isProxy, const QString &challengingHost, QString *outUser, QString *outPassword)
+bool QWebEnginePagePrivate::authenticationRequired(const QUrl &requestUrl, const QString &realm, bool isProxy, const QString &challengingHost, QString *outUser, QString *outPassword)
{
Q_Q(QWebEnginePage);
QAuthenticator networkAuth;
@@ -259,8 +259,14 @@ void QWebEnginePagePrivate::authenticationRequired(const QUrl &requestUrl, const
Q_EMIT q->proxyAuthenticationRequired(requestUrl, &networkAuth, challengingHost);
else
Q_EMIT q->authenticationRequired(requestUrl, &networkAuth);
+
+ // Authentication has been cancelled
+ if (networkAuth.isNull())
+ return false;
+
*outUser = networkAuth.user();
*outPassword = networkAuth.password();
+ return true;
}
void QWebEnginePagePrivate::runMediaAccessPermissionRequest(const QUrl &securityOrigin, WebContentsAdapterClient::MediaRequestFlags requestFlags)