3333 service_unavailable ,
3434)
3535from uvicorn .protocols .utils import (
36+ TLSInfo ,
3637 get_client_addr ,
3738 get_local_addr ,
3839 get_path_with_query_string ,
3940 get_remote_addr ,
4041 get_tls_info ,
4142 is_ssl ,
4243)
44+ from uvicorn .server import ServerState
4345
4446HEADER_RE = re .compile (b'[\x00 -\x1f \x7f ()<>@,;:[]={} \t \\ "]' )
4547HEADER_VALUE_RE = re .compile (b"[\x00 -\x08 \x0a -\x1f \x7f ]" )
@@ -103,7 +105,7 @@ def __init__(
103105 self .client : tuple [str , int ] | None = None
104106 self .scheme : Literal ["http" , "https" ] | None = None
105107 self .pipeline : deque [tuple [RequestResponseCycle , ASGI3Application ]] = deque ()
106- self .tls : dict [ object , object ] = {}
108+ self .tls : TLSInfo = TLSInfo ()
107109
108110 # Per-request state
109111 self .scope : HTTPScope = None # type: ignore[assignment]
@@ -124,7 +126,7 @@ def connection_made( # type: ignore[override]
124126 self .scheme = "https" if is_ssl (transport ) else "http"
125127
126128 if self .config .is_ssl :
127- self .tls = get_tls_info (transport ,self .config )
129+ self .tls = get_tls_info (transport , self .config )
128130
129131 if self .logger .level <= TRACE_LOG_LEVEL :
130132 prefix = "%s:%d - " % self .client if self .client else ""
@@ -250,11 +252,11 @@ def on_message_begin(self) -> None:
250252 "root_path" : self .root_path ,
251253 "headers" : self .headers ,
252254 "state" : self .app_state .copy (),
253- "extensions" : {},
255+ "extensions" : {},
254256 }
255257
256258 if self .config .is_ssl :
257- self .scope ["extensions" ]["tls" ] = self .tls
259+ self .scope ["extensions" ]["tls" ] = cast ( dict [ object , object ], self .tls )
258260
259261 # Parser callbacks
260262 def on_url (self , url : bytes ) -> None :
0 commit comments