diff -r f4c6dab59cd8 Lib/test/test_urllib.py --- a/Lib/test/test_urllib.py Tue Apr 26 17:04:18 2016 +0200 +++ b/Lib/test/test_urllib.py Wed Apr 27 11:02:17 2016 +0800 @@ -230,6 +230,9 @@ self.assertTrue(urllib.request.proxy_bypass_environment('anotherdomain.com')) self.assertTrue(urllib.request.proxy_bypass_environment('anotherdomain.com:8888')) self.assertTrue(urllib.request.proxy_bypass_environment('newdomain.com:1234')) + self.assertTrue(urllib.request.proxy_bypass_environment('LOCALHOST')) + self.assertTrue(urllib.request.proxy_bypass_environment('ANOTHERDOMAIN.COM')) + self.assertTrue(urllib.request.proxy_bypass_environment('NEWDOMAIN.COM:1234')) class ProxyTests_withOrderedEnv(unittest.TestCase): diff -r f4c6dab59cd8 Lib/urllib/request.py --- a/Lib/urllib/request.py Tue Apr 26 17:04:18 2016 +0200 +++ b/Lib/urllib/request.py Wed Apr 27 11:02:17 2016 +0800 @@ -2488,9 +2488,10 @@ if no_proxy == '*': return 1 # strip port off host + host = host.lower() hostonly, port = splitport(host) # check if the host ends with any of the DNS suffixes - no_proxy_list = [proxy.strip() for proxy in no_proxy.split(',')] + no_proxy_list = [proxy.strip() for proxy in no_proxy.lower().split(',')] for name in no_proxy_list: if name and (hostonly.endswith(name) or host.endswith(name)): return 1