summaryrefslogtreecommitdiff
path: root/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-02-24 16:36:50 +0100
committerSimon Hausmann <simon.hausmann@nokia.com>2012-02-24 16:36:50 +0100
commitad0d549d4cc13433f77c1ac8f0ab379c83d93f28 (patch)
treeb34b0daceb7c8e7fdde4b4ec43650ab7caadb0a9 /Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.cpp
parent03e12282df9aa1e1fb05a8b90f1cfc2e08764cec (diff)
downloadqtwebkit-ad0d549d4cc13433f77c1ac8f0ab379c83d93f28.tar.gz
Imported WebKit commit bb52bf3c0119e8a128cd93afe5572413a8617de9 (http://svn.webkit.org/repository/webkit/trunk@108790)
Diffstat (limited to 'Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.cpp')
-rw-r--r--Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.cpp b/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.cpp
index 28efc0c82..ce46be854 100644
--- a/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.cpp
+++ b/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.cpp
@@ -33,6 +33,7 @@
#include "WebPageProxyMessages.h"
#include "WebProcess.h"
#include <QAuthenticator>
+#include <QNetworkProxy>
#include <QNetworkReply>
#include <QNetworkRequest>
@@ -43,6 +44,7 @@ QtNetworkAccessManager::QtNetworkAccessManager(WebProcess* webProcess)
, m_webProcess(webProcess)
{
connect(this, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)), SLOT(onAuthenticationRequired(QNetworkReply*, QAuthenticator*)));
+ connect(this, SIGNAL(proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)), SLOT(onProxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)));
connect(this, SIGNAL(sslErrors(QNetworkReply*, QList<QSslError>)), SLOT(onSslErrors(QNetworkReply*, QList<QSslError>)));
}
@@ -73,6 +75,31 @@ void QtNetworkAccessManager::registerApplicationScheme(const WebPage* page, cons
m_applicationSchemes.insert(page, scheme.toLower());
}
+void QtNetworkAccessManager::onProxyAuthenticationRequired(const QNetworkProxy& proxy, QAuthenticator* authenticator)
+{
+ // FIXME: Check if there is a better way to get a reference to the page.
+ WebPage* webPage = m_webProcess->focusedWebPage();
+
+ if (!webPage)
+ return;
+
+ String hostname = proxy.hostName();
+ uint16_t port = static_cast<uint16_t>(proxy.port());
+ String prefilledUsername = authenticator->user();
+ String username;
+ String password;
+
+ if (webPage->sendSync(
+ Messages::WebPageProxy::ProxyAuthenticationRequiredRequest(hostname, port, prefilledUsername),
+ Messages::WebPageProxy::ProxyAuthenticationRequiredRequest::Reply(username, password))) {
+ if (!username.isEmpty())
+ authenticator->setUser(username);
+ if (!password.isEmpty())
+ authenticator->setPassword(password);
+ }
+
+}
+
void QtNetworkAccessManager::onAuthenticationRequired(QNetworkReply* reply, QAuthenticator* authenticator)
{
WebPage* webPage = obtainOriginatingWebPage(reply->request());