Skip to content

Commit 149226d

Browse files
bulletmarkdpgeorge
authored andcommitted
uaiohttpclient: Fix hard coded port 80.
Signed-off-by: Mark Blakeney <mark.blakeney@bullet-systems.net>
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 8 additions & 1 deletion
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy