summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorMiss Skeleton (bot) <31488909+miss-islington@users.noreply.github.com>2020-10-20 07:17:58 (GMT)
committerGitHub <noreply@github.com>2020-10-20 07:17:58 (GMT)
commite7c5a43984f82ef9634cb0b2b8c4750b2fd431a0 (patch)
treed5a82fc51c3700ae6e7bd09803d8440fdc037bed /Lib/test
parent65894cac0835cb8f469f649e20aa1be8bf89f5ae (diff)
downloadcpython-e7c5a43984f82ef9634cb0b2b8c4750b2fd431a0.zip
cpython-e7c5a43984f82ef9634cb0b2b8c4750b2fd431a0.tar.gz
cpython-e7c5a43984f82ef9634cb0b2b8c4750b2fd431a0.tar.bz2
bpo-41471: Ignore invalid prefix lengths in system proxy settings on macOS (GH-22762) (GH-22774)
(cherry picked from commit 93a1ccabdede416425473329b8c718d507c55e29) Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_urllib2.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py
index 091b397..0132059 100644
--- a/Lib/test/test_urllib2.py
+++ b/Lib/test/test_urllib2.py
@@ -1444,6 +1444,18 @@ class HandlerTests(unittest.TestCase):
bypass = {'exclude_simple': True, 'exceptions': []}
self.assertTrue(_proxy_bypass_macosx_sysconf('test', bypass))
+ # Check that invalid prefix lengths are ignored
+ bypass = {
+ 'exclude_simple': False,
+ 'exceptions': [ '10.0.0.0/40', '172.19.10.0/24' ]
+ }
+ host = '172.19.10.5'
+ self.assertTrue(_proxy_bypass_macosx_sysconf(host, bypass),
+ 'expected bypass of %s to be True' % host)
+ host = '10.0.1.5'
+ self.assertFalse(_proxy_bypass_macosx_sysconf(host, bypass),
+ 'expected bypass of %s to be False' % host)
+
def check_basic_auth(self, headers, realm):
with self.subTest(realm=realm, headers=headers):
opener = OpenerDirector()