summaryrefslogtreecommitdiff
path: root/Lib/test/test_urllib.py
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2016-04-30 01:03:40 +0000
committerMartin Panter <vadmium+py@gmail.com>2016-04-30 01:03:40 +0000
commitaa27982ffca6ebfaad0a776e93e98a30e95b8b88 (patch)
tree64d9c45f8e0f7904056029a0bc92f51ebdb731b0 /Lib/test/test_urllib.py
parent6d34bbbfc7ac1a5a8d518ed1b767239de26650c5 (diff)
downloadcpython-git-aa27982ffca6ebfaad0a776e93e98a30e95b8b88.tar.gz
Issue #26864: Fix case insensitivity and suffix comparison with no_proxy
Patch by Xiang Zhang.
Diffstat (limited to 'Lib/test/test_urllib.py')
-rw-r--r--Lib/test/test_urllib.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py
index 3bf9ea71ee..49e2a2cd61 100644
--- a/Lib/test/test_urllib.py
+++ b/Lib/test/test_urllib.py
@@ -231,6 +231,19 @@ class ProxyTests(unittest.TestCase):
self.assertTrue(urllib.request.proxy_bypass_environment('anotherdomain.com:8888'))
self.assertTrue(urllib.request.proxy_bypass_environment('newdomain.com:1234'))
+ def test_proxy_bypass_environment_host_match(self):
+ bypass = urllib.request.proxy_bypass_environment
+ self.env.set('NO_PROXY',
+ 'localhost, anotherdomain.com, newdomain.com:1234')
+ self.assertTrue(bypass('localhost'))
+ self.assertTrue(bypass('LocalHost')) # MixedCase
+ self.assertTrue(bypass('LOCALHOST')) # UPPERCASE
+ self.assertTrue(bypass('newdomain.com:1234'))
+ self.assertTrue(bypass('anotherdomain.com:8888'))
+ self.assertTrue(bypass('www.newdomain.com:1234'))
+ self.assertFalse(bypass('prelocalhost'))
+ self.assertFalse(bypass('newdomain.com')) # no port
+ self.assertFalse(bypass('newdomain.com:1235')) # wrong port
class ProxyTests_withOrderedEnv(unittest.TestCase):