diff options
author | Michal Klocek <michal.klocek@qt.io> | 2019-02-05 13:54:04 +0100 |
---|---|---|
committer | Michal Klocek <michal.klocek@qt.io> | 2019-02-19 10:31:58 +0000 |
commit | 42d8036576c340e9d4cca45361c448f184957aa6 (patch) | |
tree | 5dc37bade330f9d744c1d598e6680de0bb5a9010 /src/core/web_engine_context.cpp | |
parent | 6e374f9d08703f9c872f092ea5f50caa5dfbea26 (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/web_engine_context.cpp')
-rw-r--r-- | src/core/web_engine_context.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 67639dc4f..adf98a3e1 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -114,6 +114,7 @@ #include <QSurfaceFormat> #include <QVector> #include <qpa/qplatformnativeinterface.h> +#include <QNetworkProxy> using namespace QtWebEngineCore; @@ -335,6 +336,18 @@ void WebEngineContext::destroyContextPostRoutine() m_destroyed = true; } +ProxyAuthentication WebEngineContext::qProxyNetworkAuthentication(QString host, int port) +{ + if (!QNetworkProxyFactory::usesSystemConfiguration()) { + QNetworkProxy proxy = QNetworkProxy::applicationProxy(); + if (host == proxy.hostName() && port == proxy.port() && !proxy.user().isEmpty() + && !proxy.password().isEmpty()) { + return std::make_tuple(true, proxy.user(), proxy.password()); + } + } + return std::make_tuple(false, QString(), QString()); +} + #ifndef CHROMIUM_VERSION #error Chromium version should be defined at gyp-time. Something must have gone wrong #define CHROMIUM_VERSION // This is solely to keep Qt Creator happy. |