From 9ec222c363b226e908a9d72018e2f467952da52f Mon Sep 17 00:00:00 2001 From: Kamil Madac Date: Mon, 2 Dec 2013 22:40:26 +0100 Subject: [PATCH 1/2] Added test for domain name no_proxy matching. --- .idea/dictionaries/kmadac.xml | 3 +++ test_requests.py | 8 ++++++++ 2 files changed, 11 insertions(+) create mode 100644 .idea/dictionaries/kmadac.xml diff --git a/.idea/dictionaries/kmadac.xml b/.idea/dictionaries/kmadac.xml new file mode 100644 index 00000000..93bbf4db --- /dev/null +++ b/.idea/dictionaries/kmadac.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/test_requests.py b/test_requests.py index cb91ade1..4aa86c3d 100755 --- a/test_requests.py +++ b/test_requests.py @@ -917,7 +917,15 @@ class UtilsTestCase(unittest.TestCase): assert get_environ_proxies('http://192.168.0.1:5000/') == {} assert get_environ_proxies('http://192.168.0.1/') == {} assert get_environ_proxies('http://172.16.1.1/') == {} + assert get_environ_proxies('http://172.16.1.1:5000/') == {} assert get_environ_proxies('http://192.168.1.1:5000/') == {'no': os.environ['no_proxy']} + def test_get_environ_proxies(self): + """ Ensures that IP addresses are correctly matches with ranges in no_proxy variable """ + from requests.utils import get_environ_proxies + os.environ['no_proxy'] = "127.0.0.1,localhost.localdomain,192.168.0.0/24,172.16.1.1" + assert get_environ_proxies('http://localhost.localdomain:5000/test/') == {} + assert get_environ_proxies('http://www.requests.com/') == {'no': os.environ['no_proxy']} + if __name__ == '__main__': unittest.main() From f9a48e0f0b79c1f6dc148b1abc6a2622c48b1ab1 Mon Sep 17 00:00:00 2001 From: Kamil Madac Date: Mon, 2 Dec 2013 22:42:20 +0100 Subject: [PATCH 2/2] Added kamil.madac to Authors --- AUTHORS.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.rst b/AUTHORS.rst index 2636fa6c..b0a7e241 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -143,3 +143,4 @@ Patches and Suggestions - Thomas Weißschuh @t-8ch - Jayson Vantuyl @kagato - Pengfei.X +- Kamil Madac