Skip to content
This repository was archived by the owner on Jan 13, 2021. It is now read-only.

Commit e6031a9

Browse files
committed
Add host and proxy ipv6 test cases
1 parent 4a2aeea commit e6031a9

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

test/test_http11.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@ def test_initialization_proxy_with_separate_port(self):
9696
assert c.proxy_host == 'localhost'
9797
assert c.proxy_port == 8443
9898

99+
def test_initialization_with_ipv6_addresses_proxy_inline_port(self):
100+
c = HTTP11Connection('abcd:dcba::1234', proxy_host='[ffff:aaaa::1]:8443')
101+
102+
assert c.host == 'abcd:dcba::1234'
103+
assert c.port == 80
104+
assert not c.secure
105+
assert c.proxy_host == 'ffff:aaaa::1'
106+
assert c.proxy_port == 8443
99107

100108
def test_basic_request(self):
101109
c = HTTP11Connection('httpbin.org')

test/test_hyper.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,15 @@ def test_connections_can_parse_proxy_hosts_and_ports(self):
6363
assert c.proxy_host == 'localhost'
6464
assert c.proxy_port == 8443
6565

66+
def test_connections_can_parse_ipv6_hosts_and_ports(self):
67+
c = HTTP20Connection('abcd:dcba::1234',
68+
proxy_host='[ffff:aaaa::1]:8443')
69+
70+
assert c.host == 'abcd:dcba::1234'
71+
assert c.port == 80
72+
assert c.proxy_host == 'ffff:aaaa::1'
73+
assert c.proxy_port == 8443
74+
6675
def test_putrequest_establishes_new_stream(self):
6776
c = HTTP20Connection("www.google.com")
6877

0 commit comments

Comments
 (0)