diff --git a/libmproxy/utils.py b/libmproxy/utils.py index f3c36f8f8..165404348 100644 --- a/libmproxy/utils.py +++ b/libmproxy/utils.py @@ -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] diff --git a/test/test_utils.py b/test/test_utils.py index 90585194c..510dbd597 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -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):