Skip to content

Commit a725c42

Browse files
karfasdpgeorge
authored andcommitted
urequests: Always open sockets in SOCK_STREAM mode.
On the ESP32, socket.getaddrinfo() might return SOCK_DGRAM instead of SOCK_STREAM, eg with ".local" adresses. As a HTTP request is always a TCP stream, we don't need to rely on the values returned by getaddrinfo.
1 parent b29cffb commit a725c42

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

python-ecosys/urequests/urequests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def request(
7272
if parse_headers is not False:
7373
resp_d = {}
7474

75-
s = usocket.socket(ai[0], ai[1], ai[2])
75+
s = usocket.socket(ai[0], usocket.SOCK_STREAM, ai[2])
7676
try:
7777
s.connect(ai[-1])
7878
if proto == "https:":

0 commit comments

Comments
 (0)