From 175109e44e419dcc1792d8f7171782448c5c3ea4 Mon Sep 17 00:00:00 2001 From: Shadab Zafar Date: Thu, 18 Feb 2016 07:01:52 +0530 Subject: Use host header values only when the ports match --- test/netlib/http/test_request.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/netlib/http/test_request.py b/test/netlib/http/test_request.py index 4f8a34c2..350b5405 100644 --- a/test/netlib/http/test_request.py +++ b/test/netlib/http/test_request.py @@ -104,19 +104,23 @@ class TestRequestUtils(object): def test_pretty_host(self): request = treq() + # Without host header assert request.pretty_host == "address" assert request.host == "address" + # Same port as self.port (22) request.headers["host"] = "other:22" assert request.pretty_host == "other" + # Different Ports request.headers["host"] = "other" - assert request.pretty_host == "other" + assert request.pretty_host == "address" assert request.host == "address" + # Empty host request.host = None assert request.pretty_host is None assert request.host is None # Invalid IDNA - request.headers["host"] = ".disqus.com" + request.headers["host"] = ".disqus.com:22" assert request.pretty_host == ".disqus.com" def test_pretty_url(self): -- cgit v1.2.3