@@ -71,10 +71,18 @@ def __init__(
7171 try :
7272 self .api_key = UUID (api_key )
7373
74- self .ctx = ssl .create_default_context (ssl .Purpose .SERVER_AUTH )
75- self .ctx .set_alpn_protocols (["h2" ])
76- self .ctx .load_verify_locations (cadata = server_ca )
77- self .ctx .check_hostname = True
74+ self .h2_ctx = ssl .create_default_context (ssl .Purpose .SERVER_AUTH )
75+ self .h2_ctx .load_verify_locations (cadata = server_ca )
76+ self .h2_ctx .check_hostname = True
77+ self .h2_ctx .set_alpn_protocols (["h2" ])
78+
79+ self .http1_ctx = ssl .create_default_context (ssl .Purpose .SERVER_AUTH )
80+ self .http1_ctx .load_verify_locations (cadata = server_ca )
81+ self .http1_ctx .check_hostname = True
82+ self .http1_ctx .set_alpn_protocols (["http/1.1" ])
83+
84+ # Backward-compatible alias for existing transport code that still expects `self.ctx`.
85+ self .ctx = self .h2_ctx
7886
7987 except ssl .SSLError as e :
8088 raise NodeAPIError (- 1 , f"SSL initialization failed: { str (e )} " )
@@ -115,7 +123,7 @@ def __init__(
115123 self ._shutdown_event = asyncio .Event ()
116124
117125 self ._json_client = LazyClientSession (
118- ssl_context = self .ctx ,
126+ ssl_context = self .http1_ctx ,
119127 headers = {"Content-Type" : "application/json" , "x-api-key" : api_key },
120128 base_url = service_url ,
121129 timeout = make_timeout (default_timeout ),
0 commit comments