diff options
author | Shadab Zafar <dufferzafar0@gmail.com> | 2016-02-18 20:09:28 +0530 |
---|---|---|
committer | Shadab Zafar <dufferzafar0@gmail.com> | 2016-02-18 20:12:45 +0530 |
commit | 9dc12242822d0361cdf25ba2a2bb6e17dbd35eb6 (patch) | |
tree | c8980afd4ade8879c49e80c7878e0c4b816d4a71 /netlib | |
parent | 175109e44e419dcc1792d8f7171782448c5c3ea4 (diff) | |
download | mitmproxy-9dc12242822d0361cdf25ba2a2bb6e17dbd35eb6.tar.gz mitmproxy-9dc12242822d0361cdf25ba2a2bb6e17dbd35eb6.tar.bz2 mitmproxy-9dc12242822d0361cdf25ba2a2bb6e17dbd35eb6.zip |
Incorporate comments made during review
Diffstat (limited to 'netlib')
-rw-r--r-- | netlib/netlib/http/request.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/netlib/netlib/http/request.py b/netlib/netlib/http/request.py index f53678b7..99662732 100644 --- a/netlib/netlib/http/request.py +++ b/netlib/netlib/http/request.py @@ -188,6 +188,7 @@ class Request(Message): return self.host if not port: port = 443 if self.scheme == 'https' else 80 + # Prefer the original address if host header has an unexpected form return host if port == self.port else self.host @property @@ -195,12 +196,9 @@ class Request(Message): """ Like :py:attr:`url`, but using :py:attr:`pretty_host` instead of :py:attr:`host`. """ - host, port = self._parse_host_header() - host = host or self.host - port = port or self.port if self.first_line_format == "authority": - return "%s:%d" % (host, port) - return utils.unparse_url(self.scheme, host, port, self.path) + return "%s:%d" % (self.pretty_host, self.port) + return utils.unparse_url(self.scheme, self.pretty_host, self.port, self.path) @property def query(self): |