diff options
author | Shadab Zafar <dufferzafar0@gmail.com> | 2016-02-18 07:01:52 +0530 |
---|---|---|
committer | Shadab Zafar <dufferzafar0@gmail.com> | 2016-02-18 07:01:52 +0530 |
commit | 175109e44e419dcc1792d8f7171782448c5c3ea4 (patch) | |
tree | e89ed0f1af74ccd51aca2cc2ebd063ae9c0b115a /netlib | |
parent | 6f96da08c9d838e4ead43425440d6120d4a02d0f (diff) | |
download | mitmproxy-175109e44e419dcc1792d8f7171782448c5c3ea4.tar.gz mitmproxy-175109e44e419dcc1792d8f7171782448c5c3ea4.tar.bz2 mitmproxy-175109e44e419dcc1792d8f7171782448c5c3ea4.zip |
Use host header values only when the ports match
Diffstat (limited to 'netlib')
-rw-r--r-- | netlib/netlib/http/request.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/netlib/netlib/http/request.py b/netlib/netlib/http/request.py index 2be3f237..f53678b7 100644 --- a/netlib/netlib/http/request.py +++ b/netlib/netlib/http/request.py @@ -183,7 +183,12 @@ class Request(Message): This is useful in transparent mode where :py:attr:`host` is only an IP address, but may not reflect the actual destination as the Host header could be spoofed. """ - return self._parse_host_header()[0] or self.host + host, port = self._parse_host_header() + if not host: + return self.host + if not port: + port = 443 if self.scheme == 'https' else 80 + return host if port == self.port else self.host @property def pretty_url(self): |