From 7d62b186f83842e5113c96ff879c4d223df9cde8 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 11 Oct 2018 15:49:04 +1000 Subject: [PATCH] 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. --- aqt/__init__.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/aqt/__init__.py b/aqt/__init__.py index f373ed8a7..537047e48 100644 --- a/aqt/__init__.py +++ b/aqt/__init__.py @@ -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()