aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorcoletdjnz <coletdjnz@protonmail.com>2023-07-28 02:56:02 +1200
committerGitHub <noreply@github.com>2023-07-27 20:26:02 +0530
commitbbeacff7fcaa3b521066088a5ccbf34ef5070d1d (patch)
tree7cb66eb3b93374fe7e2629f94900cb2a183fdd8b /test
parentdae349da97cafe7357106a8f3187fd48a2ad1210 (diff)
downloadhypervideo-pre-bbeacff7fcaa3b521066088a5ccbf34ef5070d1d.tar.lz
hypervideo-pre-bbeacff7fcaa3b521066088a5ccbf34ef5070d1d.tar.xz
hypervideo-pre-bbeacff7fcaa3b521066088a5ccbf34ef5070d1d.zip
[networking] Ignore invalid proxies in env (#7704)
Authored by: coletdjnz
Diffstat (limited to 'test')
-rw-r--r--test/test_networking.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/test/test_networking.py b/test/test_networking.py
index dbe28359b..f0938ab91 100644
--- a/test/test_networking.py
+++ b/test/test_networking.py
@@ -930,10 +930,10 @@ class TestRequestHandlerValidation:
run_validation(handler, False, Request('http://', proxies={'http': None}))
run_validation(handler, False, Request('http://'), proxies={'http': None})
- @pytest.mark.parametrize('proxy_url', ['//example.com', 'example.com', '127.0.0.1'])
+ @pytest.mark.parametrize('proxy_url', ['//example.com', 'example.com', '127.0.0.1', '/a/b/c'])
@pytest.mark.parametrize('handler', ['Urllib'], indirect=True)
- def test_missing_proxy_scheme(self, handler, proxy_url):
- run_validation(handler, UnsupportedRequest, Request('http://', proxies={'http': 'example.com'}))
+ def test_invalid_proxy_url(self, handler, proxy_url):
+ run_validation(handler, UnsupportedRequest, Request('http://', proxies={'http': proxy_url}))
@pytest.mark.parametrize('handler,extensions,fail', [
(handler_tests[0], extensions, fail)
@@ -1126,9 +1126,11 @@ class TestYoutubeDLNetworking:
('http', '__noproxy__', None),
('no', '127.0.0.1,foo.bar', '127.0.0.1,foo.bar'),
('https', 'example.com', 'http://example.com'),
+ ('https', '//example.com', 'http://example.com'),
('https', 'socks5://example.com', 'socks5h://example.com'),
('http', 'socks://example.com', 'socks4://example.com'),
('http', 'socks4://example.com', 'socks4://example.com'),
+ ('unrelated', '/bad/proxy', '/bad/proxy'), # clean_proxies should ignore bad proxies
])
def test_clean_proxy(self, proxy_key, proxy_url, expected):
# proxies should be cleaned in urlopen()