From 9dc12242822d0361cdf25ba2a2bb6e17dbd35eb6 Mon Sep 17 00:00:00 2001 From: Shadab Zafar Date: Thu, 18 Feb 2016 20:09:28 +0530 Subject: [PATCH] Incorporate comments made during review --- netlib/netlib/http/request.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/netlib/netlib/http/request.py b/netlib/netlib/http/request.py index f53678b7a..99662732e 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):