Skip to content

Commit 149226d

Browse files
bulletmarkdpgeorge
authored andcommitted
uaiohttpclient: Fix hard coded port 80.
Signed-off-by: Mark Blakeney <[email protected]>
1 parent ae8ea8d commit 149226d

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

micropython/uaiohttpclient/manifest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
metadata(description="HTTP client module for MicroPython uasyncio module", version="0.5.1")
1+
metadata(description="HTTP client module for MicroPython uasyncio module", version="0.5.2")
22

33
# Originally written by Paul Sokolovsky.
44

micropython/uaiohttpclient/uaiohttpclient.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,16 @@ def request_raw(method, url):
4646
except ValueError:
4747
proto, dummy, host = url.split("/", 2)
4848
path = ""
49+
50+
if ":" in host:
51+
host, port = host.split(":")
52+
port = int(port)
53+
else:
54+
port = 80
55+
4956
if proto != "http:":
5057
raise ValueError("Unsupported protocol: " + proto)
51-
reader, writer = yield from asyncio.open_connection(host, 80)
58+
reader, writer = yield from asyncio.open_connection(host, port)
5259
# Use protocol 1.0, because 1.1 always allows to use chunked transfer-encoding
5360
# But explicitly set Connection: close, even though this should be default for 1.0,
5461
# because some servers misbehave w/o it.

0 commit comments

Comments
 (0)