mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-08 14:21:01 +02:00
Merge branch 'fix/esp_prov_ipv6_resolve_v5_1' into 'release/v5.1'
fix(tools/esp_prov): Fix hostname resolving for IPv6-only host(v5.1) See merge request espressif/esp-idf!34676
This commit is contained in:
@@ -1,9 +1,6 @@
|
|||||||
# SPDX-FileCopyrightText: 2018-2022 Espressif Systems (Shanghai) CO LTD
|
# SPDX-FileCopyrightText: 2018-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
|
|
||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -20,7 +17,7 @@ from .transport import Transport
|
|||||||
class Transport_HTTP(Transport):
|
class Transport_HTTP(Transport):
|
||||||
def __init__(self, hostname, ssl_context=None):
|
def __init__(self, hostname, ssl_context=None):
|
||||||
try:
|
try:
|
||||||
socket.gethostbyname(hostname.split(':')[0])
|
socket.getaddrinfo(hostname.split(':')[0], None)
|
||||||
except socket.gaierror:
|
except socket.gaierror:
|
||||||
raise RuntimeError(f'Unable to resolve hostname: {hostname}')
|
raise RuntimeError(f'Unable to resolve hostname: {hostname}')
|
||||||
|
|
||||||
@@ -43,7 +40,7 @@ class Transport_HTTP(Transport):
|
|||||||
# While establishing a session, the device sends the Set-Cookie header
|
# While establishing a session, the device sends the Set-Cookie header
|
||||||
# with value 'session=cookie_session_id' in its first response of the session to the tool.
|
# with value 'session=cookie_session_id' in its first response of the session to the tool.
|
||||||
# To maintain the same session, successive requests from the tool should include
|
# To maintain the same session, successive requests from the tool should include
|
||||||
# an additional 'Cookie' header with the above recieved value.
|
# an additional 'Cookie' header with the above received value.
|
||||||
for hdr_key, hdr_val in response.getheaders():
|
for hdr_key, hdr_val in response.getheaders():
|
||||||
if hdr_key == 'Set-Cookie':
|
if hdr_key == 'Set-Cookie':
|
||||||
self.headers['Cookie'] = hdr_val
|
self.headers['Cookie'] = hdr_val
|
||||||
|
Reference in New Issue
Block a user