aboutsummaryrefslogtreecommitdiffstats
path: root/test/netlib/http/test_request.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-02-18 23:17:02 +0100
committerMaximilian Hils <git@maximilianhils.com>2016-02-18 23:17:02 +0100
commitecb26c3c822ff4f4c61233c8265faed666625677 (patch)
tree7dc3fb338e456fd2ef1dcf4e508b85577e10b408 /test/netlib/http/test_request.py
parent7c6bf7abb3c0e94f9c4dfa77fe0690fe11c6d4d3 (diff)
parentd6ab9901d1f4d330a624b1a41d86d8d03c910b7a (diff)
downloadmitmproxy-ecb26c3c822ff4f4c61233c8265faed666625677.tar.gz
mitmproxy-ecb26c3c822ff4f4c61233c8265faed666625677.tar.bz2
mitmproxy-ecb26c3c822ff4f4c61233c8265faed666625677.zip
Merge remote-tracking branch 'duffer/pretty-host'
Diffstat (limited to 'test/netlib/http/test_request.py')
-rw-r--r--test/netlib/http/test_request.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/test/netlib/http/test_request.py b/test/netlib/http/test_request.py
index b4ecfd4e..5672259e 100644
--- a/test/netlib/http/test_request.py
+++ b/test/netlib/http/test_request.py
@@ -104,25 +104,36 @@ class TestRequestUtils(object):
def test_pretty_host(self):
request = treq()
+ # Without host header
assert request.pretty_host == "address"
assert request.host == "address"
- request.headers["host"] = "other"
+ # 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 == "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):
request = treq()
+ # Without host header
assert request.url == "http://address:22/path"
assert request.pretty_url == "http://address:22/path"
- request.headers["host"] = "other"
+ # Same port as self.port (22)
+ request.headers["host"] = "other:22"
assert request.pretty_url == "http://other:22/path"
+ # Different ports
+ request.headers["host"] = "other"
+ assert request.pretty_url == "http://address:22/path"
def test_pretty_url_authority(self):
request = treq(first_line_format="authority")