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:
284
284
b"ws" : 80 ,
285
285
b"wss" : 443 ,
286
286
b"socks5" : 1080 ,
287
+ b"socks5h" : 1080 ,
287
288
}[self .scheme ]
288
289
return Origin (
289
290
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():
41
41
httpcore .URL (scheme = b"https" , host = b"www.example.com" , target = "/☺" .encode ("utf-8" ))
42
42
43
43
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
+
44
56
# Request
45
57
46
58
You can’t perform that action at this time.
0 commit comments