Skip to content
This repository was archived by the owner on Jan 13, 2021. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hyper/packages/rfc3986/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
HOST_PATTERN = '({0}|{1}|{2})'.format(reg_name, ipv4, ip_literal)

SUBAUTHORITY_MATCHER = re.compile((
'^(?:(?P<userinfo>[A-Za-z0-9_.~\-%:]+)@)?' # userinfo
'^(?:(?P<userinfo>[A-Za-z0-9\-._~%!$&\'()*+,;=:]+)@)?' # userinfo
'(?P<host>{0}?)' # host
':?(?P<port>\d+)?$' # port
).format(HOST_PATTERN))
Expand Down
10 changes: 10 additions & 0 deletions test/test_hyper.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@ def test_connections_accept_proxy_hosts_and_ports(self):
assert c.proxy_host == 'localhost'
assert c.proxy_port == 8443

def test_connections_can_parse_proxy_hosts_with_userinfo(self):
c = HTTP20Connection('www.google.com',
proxy_host='azAz09!==:fakepaswd@localhost:8443')
# Note that the userinfo part is getting stripped out,
# it's not automatically added as Basic Auth header to
# the proxy_headers! It should be done manually.
assert c.host == 'www.google.com'
assert c.proxy_host == 'localhost'
assert c.proxy_port == 8443

def test_connections_can_parse_proxy_hosts_and_ports(self):
c = HTTP20Connection('www.google.com',
proxy_host='localhost',
Expand Down