Skip to content
Myr

Fix assumed hostname when using a 'file' URI scheme adapter

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Kale Franz · committed by Kale Franz · parent dffd5d4 · Browse files · 2 files+5 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+5 added−0 removed

  • tests:+1 added−0 removed
  • other:+4 added−0 removed

2 files+5 added−0 removed

modified:requests/utils.py+4 added
704 unmodified lines
705 if no_proxy is None:706 no_proxy = get_proxy('no_proxy')707 parsed = urlparse(url)708709 if parsed.hostname is None:710 # URLs don't always have hostnames, e.g. file:/// urls.711 return True712713 if no_proxy:714 # We need to check whether we match here. We need to see if we match715 # the end of the hostname, both with and without the port.716 no_proxy = (
264 unmodified lines
modified:tests/test_utils.py+1 added
620 unmodified lines
621 ('http://google.com:6000/', True),622 ('http://172.16.1.12/', False),623 ('http://172.16.1.12:5000/', False),624 ('http://google.com:5000/v1.0/', False),625 ('file:///some/path/on/disk', True),626 ))627def test_should_bypass_proxies(url, expected, monkeypatch):628 """Tests for function should_bypass_proxies to check if proxy629 can be bypassed or not
153 unmodified lines