File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -284,6 +284,7 @@ def origin(self) -> Origin:
284284 b"ws" : 80 ,
285285 b"wss" : 443 ,
286286 b"socks5" : 1080 ,
287+ b"socks5h" : 1080 ,
287288 }[self .scheme ]
288289 return Origin (
289290 scheme = self .scheme , host = self .host , port = self .port or default_port
Original file line number Diff line number Diff line change @@ -41,6 +41,18 @@ def test_url_cannot_include_unicode_strings():
4141 httpcore .URL (scheme = b"https" , host = b"www.example.com" , target = "/☺" .encode ("utf-8" ))
4242
4343
44+ def test_url_origin_socks5 ():
45+ url = httpcore .URL ("socks5://127.0.0.1" )
46+ origin = url .origin
47+ assert origin == httpcore .Origin (scheme = b"socks5" , host = b"127.0.0.1" , port = 1080 )
48+ assert str (origin ) == "socks5://127.0.0.1:1080"
49+
50+ url = httpcore .URL ("socks5h://127.0.0.1" )
51+ origin = url .origin
52+ assert origin == httpcore .Origin (scheme = b"socks5h" , host = b"127.0.0.1" , port = 1080 )
53+ assert str (origin ) == "socks5h://127.0.0.1:1080"
54+
55+
4456# Request
4557
4658
You can’t perform that action at this time.
0 commit comments