no_proxy can now be upper case
ProxyInfo.from_environment now honors no_proxy=*
ProxyInfo.applies_to now matches the domain of the host (consistent with Python's urllib)
diff --git a/python2/httplib2test.py b/python2/httplib2test.py
index 705cc38..48b2360 100755
--- a/python2/httplib2test.py
+++ b/python2/httplib2test.py
@@ -1599,10 +1599,18 @@
def test_applies_to(self):
os.environ['http_proxy'] = 'http://myproxy.example.com:80'
os.environ['https_proxy'] = 'http://myproxy.example.com:81'
- os.environ['no_proxy'] = 'localhost,otherhost.domain.local'
+ os.environ['no_proxy'] = 'localhost,otherhost.domain.local,example.com'
pi = httplib2.ProxyInfo.from_environment()
self.assertFalse(pi.applies_to('localhost'))
self.assertTrue(pi.applies_to('www.google.com'))
+ self.assertFalse(pi.applies_to('www.example.com'))
+
+ def test_no_proxy_star(self):
+ os.environ['http_proxy'] = 'http://myproxy.example.com:80'
+ os.environ['NO_PROXY'] = '*'
+ pi = httplib2.ProxyInfo.from_environment()
+ for host in ('localhost', '169.254.38.192', 'www.google.com'):
+ self.assertFalse(pi.applies_to(host))
if __name__ == '__main__':