Firm up what we consider to be a valid proxy spec.

This commit is contained in:
Aldo Cortesi 2012-02-18 16:29:02 +13:00
parent 6ad8b1a15d
commit 7aa79b89e8
2 changed files with 2 additions and 1 deletions

View File

@ -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]

View File

@ -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):