33
33
service_unavailable ,
34
34
)
35
35
from uvicorn .protocols .utils import (
36
+ TLSInfo ,
36
37
get_client_addr ,
37
38
get_local_addr ,
38
39
get_path_with_query_string ,
39
40
get_remote_addr ,
40
41
get_tls_info ,
41
42
is_ssl ,
42
43
)
44
+ from uvicorn .server import ServerState
43
45
44
46
HEADER_RE = re .compile (b'[\x00 -\x1f \x7f ()<>@,;:[]={} \t \\ "]' )
45
47
HEADER_VALUE_RE = re .compile (b"[\x00 -\x08 \x0a -\x1f \x7f ]" )
@@ -103,7 +105,7 @@ def __init__(
103
105
self .client : tuple [str , int ] | None = None
104
106
self .scheme : Literal ["http" , "https" ] | None = None
105
107
self .pipeline : deque [tuple [RequestResponseCycle , ASGI3Application ]] = deque ()
106
- self .tls : dict [ object , object ] = {}
108
+ self .tls : TLSInfo = TLSInfo ()
107
109
108
110
# Per-request state
109
111
self .scope : HTTPScope = None # type: ignore[assignment]
@@ -124,7 +126,7 @@ def connection_made( # type: ignore[override]
124
126
self .scheme = "https" if is_ssl (transport ) else "http"
125
127
126
128
if self .config .is_ssl :
127
- self .tls = get_tls_info (transport ,self .config )
129
+ self .tls = get_tls_info (transport , self .config )
128
130
129
131
if self .logger .level <= TRACE_LOG_LEVEL :
130
132
prefix = "%s:%d - " % self .client if self .client else ""
@@ -250,11 +252,11 @@ def on_message_begin(self) -> None:
250
252
"root_path" : self .root_path ,
251
253
"headers" : self .headers ,
252
254
"state" : self .app_state .copy (),
253
- "extensions" : {},
255
+ "extensions" : {},
254
256
}
255
257
256
258
if self .config .is_ssl :
257
- self .scope ["extensions" ]["tls" ] = self .tls
259
+ self .scope ["extensions" ]["tls" ] = dict ( self .tls )
258
260
259
261
# Parser callbacks
260
262
def on_url (self , url : bytes ) -> None :
0 commit comments