From 640ad8dd995c480080868f62be1e4f012d4f07f1 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sat, 1 Jul 2023 14:33:50 +0100 Subject: [PATCH] Fix transport is None error --- aiohttp/connector.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/aiohttp/connector.py b/aiohttp/connector.py index 959a81c47a4..b05e688fb25 100644 --- a/aiohttp/connector.py +++ b/aiohttp/connector.py @@ -1062,6 +1062,9 @@ async def _start_tls_connection( f"[{type_err!s}]" ) from type_err else: + if tls_transport is None: + msg = "Failed to start TLS (possibly caused by closing transport)" + raise client_error(req.connection_key, OSError(msg)) tls_proto.connection_made( tls_transport ) # Kick the state machine of the new TLS protocol