Incorporate comments made during review

This commit is contained in:
Shadab Zafar 2016-02-18 20:09:28 +05:30
parent 175109e44e
commit 9dc1224282

View File

@ -188,6 +188,7 @@ class Request(Message):
return self.host return self.host
if not port: if not port:
port = 443 if self.scheme == 'https' else 80 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 return host if port == self.port else self.host
@property @property
@ -195,12 +196,9 @@ class Request(Message):
""" """
Like :py:attr:`url`, but using :py:attr:`pretty_host` instead of :py:attr:`host`. 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": if self.first_line_format == "authority":
return "%s:%d" % (host, port) return "%s:%d" % (self.pretty_host, self.port)
return utils.unparse_url(self.scheme, host, port, self.path) return utils.unparse_url(self.scheme, self.pretty_host, self.port, self.path)
@property @property
def query(self): def query(self):