Fix SSL certificate validation / Fix tariff sorting for subscription renewals
This commit is contained in:
+5
-2
@@ -41,8 +41,11 @@ async def check_tcp_connection(host: str, port: int) -> bool:
|
||||
await writer.wait_closed()
|
||||
return True
|
||||
except ssl.SSLError as e:
|
||||
err_text = str(e)
|
||||
if "hostname mismatch" in err_text or "certificate is not valid for" in err_text:
|
||||
return False
|
||||
logger.warning(f"[SSL Error] Сертификат сервера {host} вызвал ошибку: {e}")
|
||||
await notify_ssl_error(host, str(e))
|
||||
await notify_ssl_error(host, err_text)
|
||||
return False
|
||||
except Exception:
|
||||
return False
|
||||
@@ -171,4 +174,4 @@ async def check_servers(session: AsyncSession):
|
||||
def extract_host(api_url: str) -> str:
|
||||
"""Извлекает хост из `api_url`."""
|
||||
match = re.match(r"(https?://)?([^:/]+)", api_url)
|
||||
return match.group(2) if match else api_url
|
||||
return match.group(2) if match else api_url
|
||||
Reference in New Issue
Block a user