From ab2b98b988e6ec76d2c0f79dfe52d9ff4096619c Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Fri, 10 Apr 2015 19:35:42 +0200 Subject: fix pretty_host if no host is present --- libmproxy/protocol/http.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'libmproxy') diff --git a/libmproxy/protocol/http.py b/libmproxy/protocol/http.py index 05657ea6..93065b47 100644 --- a/libmproxy/protocol/http.py +++ b/libmproxy/protocol/http.py @@ -631,8 +631,10 @@ class HTTPRequest(HTTPMessage): host = self.headers.get_first("host") if not host: host = self.host - host = host.encode("idna") - return host + if host: + return host.encode("idna") + else: + return None def pretty_url(self, hostheader): if self.form_out == "authority": # upstream proxy mode -- cgit v1.2.3