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):
|
def parse_proxy_spec(url):
|
||||||
p = parse_url(url)
|
p = parse_url(url)
|
||||||
if not p:
|
if not p or not p[1]:
|
||||||
return None
|
return None
|
||||||
return p[:3]
|
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:88") == ("http", "foo.com", 88)
|
||||||
assert utils.parse_proxy_spec("http://foo.com") == ("http", "foo.com", 80)
|
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("foo.com")
|
||||||
|
assert not utils.parse_proxy_spec("http://")
|
||||||
|
|
||||||
|
|
||||||
class u_unparse_url(libpry.AutoTree):
|
class u_unparse_url(libpry.AutoTree):
|
||||||
|
|
Loading…
Reference in New Issue