Merge pull request #4723 from kalefranz/fix-no_proxy-file-url

Fix assumed hostname when using a 'file' URI scheme adapter
This commit is contained in:
Nate Prewitt
2018-08-13 09:54:33 -07:00
committed by GitHub
2 changed files with 5 additions and 0 deletions
+4
View File
@@ -706,6 +706,10 @@ def should_bypass_proxies(url, no_proxy):
no_proxy = get_proxy('no_proxy')
parsed = urlparse(url)
if parsed.hostname is None:
# URLs don't always have hostnames, e.g. file:/// urls.
return True
if no_proxy:
# We need to check whether we match here. We need to see if we match
# the end of the hostname, both with and without the port.
+1
View File
@@ -622,6 +622,7 @@ def test_urldefragauth(url, expected):
('http://172.16.1.12/', False),
('http://172.16.1.12:5000/', False),
('http://google.com:5000/v1.0/', False),
('file:///some/path/on/disk', True),
))
def test_should_bypass_proxies(url, expected, monkeypatch):
"""Tests for function should_bypass_proxies to check if proxy