Skip to content
Open
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
10 changes: 9 additions & 1 deletion uaiohttpclient/uaiohttpclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,17 @@ def request_raw(method, url):
except ValueError:
proto, dummy, host = url.split("/", 2)
path = ""

host_port = host.rsplit("@", 1)[-1]
try:
host, port = host_port.rsplit(":", 1)
except ValueError:
host = host_port
port = 80

if proto != "http:":
raise ValueError("Unsupported protocol: " + proto)
reader, writer = yield from asyncio.open_connection(host, 80)
reader, writer = yield from asyncio.open_connection(host, port)
# Use protocol 1.0, because 1.1 always allows to use chunked transfer-encoding
# But explicitly set Connection: close, even though this should be default for 1.0,
# because some servers misbehave w/o it.
Expand Down