kopia lustrzana https://github.com/micropython/micropython-lib
uaiohttpclient: Fix hard coded port 80.
Signed-off-by: Mark Blakeney <mark.blakeney@bullet-systems.net>pull/764/head
rodzic
ae8ea8d113
commit
149226d3f7
|
@ -1,4 +1,4 @@
|
|||
metadata(description="HTTP client module for MicroPython uasyncio module", version="0.5.1")
|
||||
metadata(description="HTTP client module for MicroPython uasyncio module", version="0.5.2")
|
||||
|
||||
# Originally written by Paul Sokolovsky.
|
||||
|
||||
|
|
|
@ -46,9 +46,16 @@ def request_raw(method, url):
|
|||
except ValueError:
|
||||
proto, dummy, host = url.split("/", 2)
|
||||
path = ""
|
||||
|
||||
if ":" in host:
|
||||
host, port = host.split(":")
|
||||
port = int(port)
|
||||
else:
|
||||
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.
|
||||
|
|
Ładowanie…
Reference in New Issue