Skip to content

Commit 214910f

Browse files
committed
Merge branch 'fix/esp_prov_ipv6_resolve_v5_2' into 'release/v5.2'
fix(tools/esp_prov): Fix hostname resolving for IPv6-only host(v5.2) See merge request espressif/esp-idf!34677
2 parents 450d537 + 438fd1d commit 214910f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tools/esp_prov/transport/transport_http.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
# SPDX-FileCopyrightText: 2018-2023 Espressif Systems (Shanghai) CO LTD
1+
# SPDX-FileCopyrightText: 2018-2024 Espressif Systems (Shanghai) CO LTD
22
# SPDX-License-Identifier: Apache-2.0
33
#
44
import socket
5-
from http.client import HTTPConnection, HTTPSConnection
5+
from http.client import HTTPConnection
6+
from http.client import HTTPSConnection
67

78
from utils import str_to_bytes
89

@@ -12,7 +13,7 @@
1213
class Transport_HTTP(Transport):
1314
def __init__(self, hostname, ssl_context=None):
1415
try:
15-
socket.gethostbyname(hostname.split(':')[0])
16+
socket.getaddrinfo(hostname.split(':')[0], None)
1617
except socket.gaierror:
1718
raise RuntimeError(f'Unable to resolve hostname: {hostname}')
1819

@@ -35,7 +36,7 @@ def _send_post_request(self, path, data):
3536
# While establishing a session, the device sends the Set-Cookie header
3637
# with value 'session=cookie_session_id' in its first response of the session to the tool.
3738
# To maintain the same session, successive requests from the tool should include
38-
# an additional 'Cookie' header with the above recieved value.
39+
# an additional 'Cookie' header with the above received value.
3940
for hdr_key, hdr_val in response.getheaders():
4041
if hdr_key == 'Set-Cookie':
4142
self.headers['Cookie'] = hdr_val

0 commit comments

Comments
 (0)