summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsamschott <sam.schott@outlook.com>2023-05-09 10:24:29 +0200
committerGitHub <noreply@github.com>2023-05-09 10:24:29 +0200
commit9a9b176eb7e052af84c01c0cfb3231e51f980f2d (patch)
tree4a2d96d291e99f462bb49bc138b15d5401c916ad
parentbf89d4283a28dd00836f2c312a9255f543f93fc7 (diff)
downloadcpython-git-9a9b176eb7e052af84c01c0cfb3231e51f980f2d.tar.gz
gh-104180: Read SOCKS proxies from macOS System Configuration (#104181)
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>
-rw-r--r--Misc/NEWS.d/next/macOS/2023-05-04-21-47-59.gh-issue-104180.lEJCwd.rst2
-rw-r--r--Modules/_scproxy.c5
2 files changed, 7 insertions, 0 deletions
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
index 0000000000..b6b18dcfd8
--- /dev/null
+++ b/Misc/NEWS.d/next/macOS/2023-05-04-21-47-59.gh-issue-104180.lEJCwd.rst
@@ -0,0 +1,2 @@
+Support reading SOCKS proxy configuration from macOS System Configuration.
+Patch by Sam Schott.
diff --git a/Modules/_scproxy.c b/Modules/_scproxy.c
index e66918016b..0df0324df5 100644
--- a/Modules/_scproxy.c
+++ b/Modules/_scproxy.c
@@ -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;