From f30160d8ee1a8fb454022e887677df96234f7951 Mon Sep 17 00:00:00 2001 From: Noah Levitt Date: Thu, 2 Mar 2017 15:23:50 -0800 Subject: [PATCH] avoid stack trace in case of urls without host --- setup.py | 2 +- warcprox/__init__.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index a7b06b9..e4f1fd6 100755 --- a/setup.py +++ b/setup.py @@ -51,7 +51,7 @@ except: setuptools.setup( name='warcprox', - version='2.1b1.dev53', + version='2.1b1.dev54', description='WARC writing MITM HTTP/S proxy', url='https://github.com/internetarchive/warcprox', author='Noah Levitt', diff --git a/warcprox/__init__.py b/warcprox/__init__.py index 45b38b2..70a8601 100644 --- a/warcprox/__init__.py +++ b/warcprox/__init__.py @@ -98,6 +98,8 @@ def host_matches_ip_or_domain(host, ip_or_domain): - ip_or_domain is a domain and host is the same domain - ip_or_domain is a domain and host is a subdomain of it ''' + if not host: + return False _host = normalize_host(host) _ip_or_domain = normalize_host(ip_or_domain)