QtWebEngine/Network: Difference between revisions
No edit summary |
No edit summary |
||
Line 4: | Line 4: | ||
Qt Network has | Qt Network has a various levels to set proxies for client connections (evaluated in this order): | ||
# [http://doc.qt.io/qt-5/qabstractsocket.html#setProxy QAbstractSocket::setProxy] | # [http://doc.qt.io/qt-5/qabstractsocket.html#setProxy QAbstractSocket::setProxy] | ||
# [http://doc.qt.io/qt-5/qnetworkaccessmanager.html#setProxy QNetworkAccessManager::setProxy] | |||
# [http://doc.qt.io/qt-5/qnetworkaccessmanager.html#setProxyFactory QNetworkAccessManager::setProxyFactory] | |||
# [http://doc.qt.io/qt-5/qnetworkproxy.html#setApplicationProxy QNetworkProxy::setApplicationProxy] | # [http://doc.qt.io/qt-5/qnetworkproxy.html#setApplicationProxy QNetworkProxy::setApplicationProxy] | ||
# [http://doc.qt.io/qt-5/qnetworkproxyfactory.html#setApplicationProxyFactory QNetworkProxyFactory::setApplicationProxyFactory] | # [http://doc.qt.io/qt-5/qnetworkproxyfactory.html#setApplicationProxyFactory QNetworkProxyFactory::setApplicationProxyFactory] | ||
In addition there are multiple levels: [ahttp://doc.qt.io/qt-5/qnetworkaccessmanager.html | |||
Since Qt 5.6, there's a default QNetworkProxyFactory::applicationProxyFactory that uses the system settings (see -system-proxies / -no-system-proxies configure flag). | Since Qt 5.6, there's a default QNetworkProxyFactory::applicationProxyFactory that uses the system settings (see -system-proxies / -no-system-proxies configure flag). | ||
Revision as of 09:42, 18 October 2016
Qt WebEngine uses the Chromium networking stack instead of Qt Network. This also means that the setup of proxies might differ. In general, Qt WebEngine should follow the 'least surprising route' and follow the proxy settings of Qt Network.
Proxy resolution in Qt Network
Qt Network has a various levels to set proxies for client connections (evaluated in this order):
- QAbstractSocket::setProxy
- QNetworkAccessManager::setProxy
- QNetworkAccessManager::setProxyFactory
- QNetworkProxy::setApplicationProxy
- QNetworkProxyFactory::setApplicationProxyFactory
In addition there are multiple levels: [ahttp://doc.qt.io/qt-5/qnetworkaccessmanager.html Since Qt 5.6, there's a default QNetworkProxyFactory::applicationProxyFactory that uses the system settings (see -system-proxies / -no-system-proxies configure flag).
Proxy resolution in Qt WebEngine
Qt WebEngine checks QNetworkProxy::applicationProxy once. If there is a proxy set, it is used for Chromium connections too (see proxy_config_service_qt.cpp). If not, Chromium will try to use the system proxy settings.
Note: The code path used to auto-detect proxy settings in the network differ, depending on whether --single-process is used. See https://codereview.qt-project.org/#/c/115567/ for details.
Proxy authentication
To authenticate proxies, connect to the QWebEnginePage::proxyAuthenticationRequired or WebEngineView::authenticationDialogRequested signal.
Links
http://doc.qt.io/qt-5/qtwebengine-overview.html#proxy-support