disable proxy support if 127.0.0.1 is not bypassed

There doesn't appear to be an easy way to tell WebEngine to ignore
the proxy for 127.0.0.1, so if the user has not bypassed the proxy
for local addresses, completely disable it. This may break remote
image and script references, but should at least allow the app to
load without intervention.
This commit is contained in:
Damien Elmes 2018-10-11 15:49:04 +10:00
parent 63661713df
commit 7d62b186f8

View file

@ -305,6 +305,17 @@ def _run(argv=None, exec=True):
if isMac:
app.setAttribute(Qt.AA_DontShowIconsInMenus)
# proxy configured?
from urllib.request import proxy_bypass, getproxies
if 'http' in getproxies():
# if it's not set up to bypass localhost, we'll
# need to disable proxies in the webviews
if not proxy_bypass("127.0.0.1"):
print("webview proxy use disabled")
proxy = QNetworkProxy()
proxy.setType(QNetworkProxy.NoProxy)
QNetworkProxy.setApplicationProxy(proxy)
# we must have a usable temp dir
try:
tempfile.gettempdir()