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.
pull/502/head
karfas 2021-11-27 12:01:55 +01:00 zatwierdzone przez Damien George
rodzic b29cffb3e3
commit a725c42049
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -72,7 +72,7 @@ def request(
if parse_headers is not False:
resp_d = {}
s = usocket.socket(ai[0], ai[1], ai[2])
s = usocket.socket(ai[0], usocket.SOCK_STREAM, ai[2])
try:
s.connect(ai[-1])
if proto == "https:":