summaryrefslogtreecommitdiff
path: root/data/_python3.7.3/proxies.patch
blob: b4959ace37c7dd6fbe9ba7b269c5d6d4759927b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
--- Python-3.7.3/Lib/urllib/request.py	2019-03-25 20:21:05.000000000 +0000
+++ Python-3.7.3+iPhone/Lib/urllib/request.py	2019-04-12 18:43:13.605127939 +0000
@@ -2580,21 +2580,28 @@
 
 
 if sys.platform == 'darwin':
-    from _scproxy import _get_proxy_settings, _get_proxies
-
-    def proxy_bypass_macosx_sysconf(host):
-        proxy_settings = _get_proxy_settings()
-        return _proxy_bypass_macosx_sysconf(host, proxy_settings)
-
-    def getproxies_macosx_sysconf():
-        """Return a dictionary of scheme -> proxy server URL mappings.
-
-        This function uses the MacOSX framework SystemConfiguration
-        to fetch the proxy information.
-        """
-        return _get_proxies()
+    try:
+        from _scproxy import _get_proxy_settings, _get_proxies
 
+        def proxy_bypass_macosx_sysconf(host):
+            proxy_settings = _get_proxy_settings()
+            return _proxy_bypass_macosx_sysconf(host, proxy_settings)
+
+        def getproxies_macosx_sysconf():
+            """Return a dictionary of scheme -> proxy server URL mappings.
+
+            This function uses the MacOSX framework SystemConfiguration
+            to fetch the proxy information.
+            """
+            return _get_proxies()
+
+    except ModuleNotFoundError:
+        # iOS fix:
+        def proxy_bypass_macosx_sysconf(host):
+            return False
 
+        def getproxies_macosx_sysconf():
+            return {}
 
     def proxy_bypass(host):
         """Return True, if host should be bypassed.