Allow / character in username,password fields in _PROXY envvars. (GH-… · python/cpython@df79440 (original) (raw)

Original file line number Diff line number Diff line change
@@ -1849,9 +1849,17 @@ def test_parse_proxy(self):
1849 1849 ('ftp', 'joe', 'password', 'proxy.example.com')),
1850 1850 # Test for no trailing '/' case
1851 1851 ('http://joe:password@proxy.example.com',
1852 - ('http', 'joe', 'password', 'proxy.example.com'))
1852 + ('http', 'joe', 'password', 'proxy.example.com')),
1853 +# Testcases with '/' character in username, password
1854 + ('http://user/name:password@localhost:22',
1855 + ('http', 'user/name', 'password', 'localhost:22')),
1856 + ('http://username:pass/word@localhost:22',
1857 + ('http', 'username', 'pass/word', 'localhost:22')),
1858 + ('http://user/name:pass/word@localhost:22',
1859 + ('http', 'user/name', 'pass/word', 'localhost:22')),
1853 1860 ]
1854 1861
1862 +
1855 1863 for tc, expected in parse_proxy_test_cases:
1856 1864 self.assertEqual(_parse_proxy(tc), expected)
1857 1865