summaryrefslogtreecommitdiffstats
path: root/src/core/login_delegate_qt.cpp
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2019-02-05 13:54:04 +0100
committerMichal Klocek <michal.klocek@qt.io>2019-02-19 10:31:58 +0000
commit42d8036576c340e9d4cca45361c448f184957aa6 (patch)
tree5dc37bade330f9d744c1d598e6680de0bb5a9010 /src/core/login_delegate_qt.cpp
parent6e374f9d08703f9c872f092ea5f50caa5dfbea26 (diff)
Try using authentication from QNetworkProxy
Use credentials for QNetworkProxy if set. Done-With: Allan Sandfeld Jensen <allan.jensen@qt.io> Task-number: QTBUG-58121 Change-Id: I9c7328af90f3c60144c5ecf385529f663f0e46b2 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'src/core/login_delegate_qt.cpp')
-rw-r--r--src/core/login_delegate_qt.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/core/login_delegate_qt.cpp b/src/core/login_delegate_qt.cpp
index 5b407c094..0050f87c7 100644
--- a/src/core/login_delegate_qt.cpp
+++ b/src/core/login_delegate_qt.cpp
@@ -68,6 +68,7 @@
#include "resource_context_qt.h"
#include "type_conversion.h"
#include "web_contents_view_qt.h"
+#include "web_engine_context.h"
namespace QtWebEngineCore {
@@ -118,6 +119,11 @@ QString LoginDelegateQt::host() const
return QString::fromStdString(m_authInfo->challenger.host());
}
+int LoginDelegateQt::port() const
+{
+ return m_authInfo->challenger.port();
+}
+
bool LoginDelegateQt::isProxy() const
{
return m_authInfo->is_proxy;
@@ -126,6 +132,19 @@ bool LoginDelegateQt::isProxy() const
void LoginDelegateQt::triggerDialogOnUI()
{
Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+
+ if (isProxy()) {
+ // workaround for 'ws' redefined symbols when including QNetworkProxy
+ auto authentication = WebEngineContext::qProxyNetworkAuthentication(host(), port());
+ if (std::get<0>(authentication)) {
+ base::PostTaskWithTraits(
+ FROM_HERE, { content::BrowserThread::IO },
+ base::BindOnce(&LoginDelegateQt::sendAuthToRequester, this, true,
+ std::get<1>(authentication), std::get<2>(authentication)));
+
+ return;
+ }
+ }
content::WebContentsImpl *webContents =
static_cast<content::WebContentsImpl *>(m_webContentsGetter.Run());
if (!webContents)