]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-104180: Read SOCKS proxies from macOS System Configuration (#104181)
authorsamschott <sam.schott@outlook.com>
Tue, 9 May 2023 08:24:29 +0000 (10:24 +0200)
committerGitHub <noreply@github.com>
Tue, 9 May 2023 08:24:29 +0000 (10:24 +0200)
read SOCKS proxies from macOS System Configuration in ``urllib.request``.

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
Misc/NEWS.d/next/macOS/2023-05-04-21-47-59.gh-issue-104180.lEJCwd.rst [new file with mode: 0644]
Modules/_scproxy.c

diff --git a/Misc/NEWS.d/next/macOS/2023-05-04-21-47-59.gh-issue-104180.lEJCwd.rst b/Misc/NEWS.d/next/macOS/2023-05-04-21-47-59.gh-issue-104180.lEJCwd.rst
new file mode 100644 (file)
index 0000000..b6b18dc
--- /dev/null
@@ -0,0 +1,2 @@
+Support reading SOCKS proxy configuration from macOS System Configuration.
+Patch by Sam Schott.
index e66918016b8da624105b194df556a405cf470cce..0df0324df55f7d4259f26c90ec0dee65678b1071 100644 (file)
@@ -206,6 +206,11 @@ get_proxies(PyObject* Py_UNUSED(mod), PyObject *Py_UNUSED(ignored))
         kSCPropNetProxiesGopherProxy,
         kSCPropNetProxiesGopherPort);
     if (r == -1) goto error;
+    r = set_proxy(result, "socks", proxyDict,
+        kSCPropNetProxiesSOCKSEnable,
+        kSCPropNetProxiesSOCKSProxy,
+        kSCPropNetProxiesSOCKSPort);
+    if (r == -1) goto error;
 
     CFRelease(proxyDict);
     return result;