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#
44import socket
5- from http .client import HTTPConnection , HTTPSConnection
5+ from http .client import HTTPConnection
6+ from http .client import HTTPSConnection
67
78from utils import str_to_bytes
89
1213class 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