Skip to content

Commit a8fa84e

Browse files
committed
move TLSInfo to _types
1 parent accd5f8 commit a8fa84e

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

uvicorn/_types.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ class LifespanScope(TypedDict):
9696
WWWScope = Union[HTTPScope, WebSocketScope]
9797
Scope = Union[HTTPScope, WebSocketScope, LifespanScope]
9898

99+
class TLSInfo(TypedDict, total=False):
100+
type: Literal["extensions.tls"]
101+
server_cert: str | None
102+
client_cert_chain: list[str]
103+
tls_version: str | None
104+
cipher_suite: str | None
99105

100106
class HTTPRequestEvent(TypedDict):
101107
type: Literal["http.request"]

uvicorn/protocols/utils.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import asyncio
44
import ssl
55
import urllib.parse
6-
from typing import TypedDict
6+
from _types import TLSInfo
77

88
from uvicorn._types import WWWScope
99
from uvicorn.config import Config
@@ -59,13 +59,6 @@ def get_path_with_query_string(scope: WWWScope) -> str:
5959
return path_with_query_string
6060

6161

62-
class TLSInfo(TypedDict, total=False):
63-
server_cert: str | None
64-
client_cert_chain: list[str]
65-
tls_version: str | None
66-
cipher_suite: str | None
67-
68-
6962
def get_tls_info(transport: asyncio.Transport, server_config: Config) -> TLSInfo:
7063
###
7164
# server_cert: Unable to set from transport information, need to set from server_config

0 commit comments

Comments
 (0)