File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,7 +56,9 @@ def obfuscate_password(password: str) -> str:
5656 return urllib .parse .quote (base64 .b64encode (password_enc ).decode ("utf-8" ), safe = "" )
5757
5858
59- async def async_fetch_remote_fingerprint (url : str ) -> str :
59+ async def async_fetch_remote_fingerprint (
60+ url : str , * , timeout : float | None = 10.0
61+ ) -> str :
6062 """Retrieve the SHA-256 fingerprint of the remote server's TLS certificate.
6163
6264 Connects to the server with verification disabled to grab the raw certificate,
@@ -73,7 +75,8 @@ async def async_fetch_remote_fingerprint(url: str) -> str:
7375 ssl_ctx .check_hostname = False
7476 ssl_ctx .verify_mode = ssl .CERT_NONE
7577
76- reader , writer = await asyncio .open_connection (hostname , port , ssl = ssl_ctx )
78+ async with asyncio .timeout (timeout ):
79+ reader , writer = await asyncio .open_connection (hostname , port , ssl = ssl_ctx )
7780
7881 try :
7982 ssl_obj = writer .get_extra_info ("ssl_object" )
You can’t perform that action at this time.
0 commit comments