1
- # SPDX-FileCopyrightText: 2018-2023 Espressif Systems (Shanghai) CO LTD
1
+ # SPDX-FileCopyrightText: 2018-2024 Espressif Systems (Shanghai) CO LTD
2
2
# SPDX-License-Identifier: Apache-2.0
3
3
#
4
4
import socket
5
- from http .client import HTTPConnection , HTTPSConnection
5
+ from http .client import HTTPConnection
6
+ from http .client import HTTPSConnection
6
7
7
8
from utils import str_to_bytes
8
9
12
13
class Transport_HTTP (Transport ):
13
14
def __init__ (self , hostname , ssl_context = None ):
14
15
try :
15
- socket .gethostbyname (hostname .split (':' )[0 ])
16
+ socket .getaddrinfo (hostname .split (':' )[0 ], None )
16
17
except socket .gaierror :
17
18
raise RuntimeError (f'Unable to resolve hostname: { hostname } ' )
18
19
@@ -35,7 +36,7 @@ def _send_post_request(self, path, data):
35
36
# While establishing a session, the device sends the Set-Cookie header
36
37
# with value 'session=cookie_session_id' in its first response of the session to the tool.
37
38
# 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.
39
40
for hdr_key , hdr_val in response .getheaders ():
40
41
if hdr_key == 'Set-Cookie' :
41
42
self .headers ['Cookie' ] = hdr_val
0 commit comments