From 7aa79b89e89385a234741589bef730cc0085662a Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sat, 18 Feb 2012 16:29:02 +1300 Subject: [PATCH] Firm up what we consider to be a valid proxy spec. --- libmproxy/utils.py | 2 +- test/test_utils.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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):