|
28 | 28 | LifespanType = Literal["auto", "on", "off"]
|
29 | 29 | LoopSetupType = Literal["none", "auto", "asyncio", "uvloop"]
|
30 | 30 | InterfaceType = Literal["auto", "asgi3", "asgi2", "wsgi"]
|
31 |
| - |
| 31 | +HTTPToolsLenientType = Literal[ |
| 32 | + "lenient_headers", |
| 33 | + "lenient_chunked_length", |
| 34 | + "lenient_keep_alive", |
| 35 | + "lenient_transfer_encoding", |
| 36 | + "lenient_version", |
| 37 | + "lenient_data_after_close", |
| 38 | + "lenient_optional_lf_after_cr", |
| 39 | + "lenient_optional_cr_before_lf", |
| 40 | + "lenient_optional_crlf_after_chunk", |
| 41 | + "lenient_spaces_after_chunk_size", |
| 42 | +] |
| 43 | + |
| 44 | +HTTPTOOLS_LENIENT: list[HTTPToolsLenientType] = [ |
| 45 | + "lenient_headers", |
| 46 | + "lenient_chunked_length", |
| 47 | + "lenient_keep_alive", |
| 48 | + "lenient_transfer_encoding", |
| 49 | + "lenient_version", |
| 50 | + "lenient_data_after_close", |
| 51 | + "lenient_optional_lf_after_cr", |
| 52 | + "lenient_optional_cr_before_lf", |
| 53 | + "lenient_optional_crlf_after_chunk", |
| 54 | + "lenient_spaces_after_chunk_size", |
| 55 | +] |
32 | 56 | LOG_LEVELS: dict[str, int] = {
|
33 | 57 | "critical": logging.CRITICAL,
|
34 | 58 | "error": logging.ERROR,
|
@@ -223,6 +247,7 @@ def __init__(
|
223 | 247 | headers: list[tuple[str, str]] | None = None,
|
224 | 248 | factory: bool = False,
|
225 | 249 | h11_max_incomplete_event_size: int | None = None,
|
| 250 | + lenient_flags: HTTPToolsLenientType | None = None, |
226 | 251 | ):
|
227 | 252 | self.app = app
|
228 | 253 | self.host = host
|
@@ -268,6 +293,7 @@ def __init__(
|
268 | 293 | self.encoded_headers: list[tuple[bytes, bytes]] = []
|
269 | 294 | self.factory = factory
|
270 | 295 | self.h11_max_incomplete_event_size = h11_max_incomplete_event_size
|
| 296 | + self.lenient_flags = lenient_flags |
271 | 297 |
|
272 | 298 | self.loaded = False
|
273 | 299 | self.configure_logging()
|
|
0 commit comments