mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 18:18:25 +00:00
Firm up what we consider to be a valid proxy spec.
This commit is contained in:
parent
6ad8b1a15d
commit
7aa79b89e8
@ -422,7 +422,7 @@ def parse_url(url):
|
||||
|
||||
def parse_proxy_spec(url):
|
||||
p = parse_url(url)
|
||||
if not p:
|
||||
if not p or not p[1]:
|
||||
return None
|
||||
return p[:3]
|
||||
|
||||
|
@ -206,6 +206,7 @@ class u_parse_proxy_spec(libpry.AutoTree):
|
||||
assert utils.parse_proxy_spec("http://foo.com:88") == ("http", "foo.com", 88)
|
||||
assert utils.parse_proxy_spec("http://foo.com") == ("http", "foo.com", 80)
|
||||
assert not utils.parse_proxy_spec("foo.com")
|
||||
assert not utils.parse_proxy_spec("http://")
|
||||
|
||||
|
||||
class u_unparse_url(libpry.AutoTree):
|
||||
|
Loading…
Reference in New Issue
Block a user