uvicorn 0.31.1__py3-none-any.whl → 0.32.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
uvicorn/__init__.py CHANGED
@@ -1,5 +1,5 @@
1
1
  from uvicorn.config import Config
2
2
  from uvicorn.main import Server, main, run
3
3
 
4
- __version__ = "0.31.1"
4
+ __version__ = "0.32.1"
5
5
  __all__ = ["main", "run", "Config", "Server"]
@@ -200,10 +200,7 @@ class H11Protocol(asyncio.Protocol):
200
200
  full_raw_path = self.root_path.encode("ascii") + raw_path
201
201
  self.scope = {
202
202
  "type": "http",
203
- "asgi": {
204
- "version": self.config.asgi_version,
205
- "spec_version": "2.4",
206
- },
203
+ "asgi": {"version": self.config.asgi_version, "spec_version": "2.3"},
207
204
  "http_version": event.http_version.decode("ascii"),
208
205
  "server": self.server,
209
206
  "client": self.client,
@@ -58,6 +58,14 @@ class HttpToolsProtocol(asyncio.Protocol):
58
58
  self.access_logger = logging.getLogger("uvicorn.access")
59
59
  self.access_log = self.access_logger.hasHandlers()
60
60
  self.parser = httptools.HttpRequestParser(self)
61
+
62
+ try:
63
+ # Enable dangerous leniencies to allow server to a response on the first request from a pipelined request.
64
+ self.parser.set_dangerous_leniencies(lenient_data_after_close=True)
65
+ except AttributeError: # pragma: no cover
66
+ # httptools < 0.6.3
67
+ pass
68
+
61
69
  self.ws_protocol_class = config.ws_protocol_class
62
70
  self.root_path = config.root_path
63
71
  self.limit_concurrency = config.limit_concurrency
@@ -214,7 +222,7 @@ class HttpToolsProtocol(asyncio.Protocol):
214
222
  self.headers = []
215
223
  self.scope = { # type: ignore[typeddict-item]
216
224
  "type": "http",
217
- "asgi": {"version": self.config.asgi_version, "spec_version": "2.4"},
225
+ "asgi": {"version": self.config.asgi_version, "spec_version": "2.3"},
218
226
  "http_version": "1.1",
219
227
  "server": self.server,
220
228
  "client": self.client,
uvicorn/server.py CHANGED
@@ -250,8 +250,12 @@ class Server:
250
250
  # Determine if we should exit.
251
251
  if self.should_exit:
252
252
  return True
253
- if self.config.limit_max_requests is not None:
254
- return self.server_state.total_requests >= self.config.limit_max_requests
253
+
254
+ max_requests = self.config.limit_max_requests
255
+ if max_requests is not None and self.server_state.total_requests >= max_requests:
256
+ logger.warning(f"Maximum request limit of {max_requests} exceeded. Terminating process.")
257
+ return True
258
+
255
259
  return False
256
260
 
257
261
  async def shutdown(self, sockets: list[socket.socket] | None = None) -> None:
@@ -1,14 +1,13 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: uvicorn
3
- Version: 0.31.1
3
+ Version: 0.32.1
4
4
  Summary: The lightning-fast ASGI server.
5
5
  Project-URL: Changelog, https://github.com/encode/uvicorn/blob/master/CHANGELOG.md
6
6
  Project-URL: Funding, https://github.com/sponsors/encode
7
7
  Project-URL: Homepage, https://www.uvicorn.org/
8
8
  Project-URL: Source, https://github.com/encode/uvicorn
9
9
  Author-email: Tom Christie <tom@tomchristie.com>, Marcelo Trylesinski <marcelotryle@gmail.com>
10
- License-Expression: BSD-3-Clause
11
- License-File: LICENSE.md
10
+ License: BSD-3-Clause
12
11
  Classifier: Development Status :: 4 - Beta
13
12
  Classifier: Environment :: Web Environment
14
13
  Classifier: Intended Audience :: Developers
@@ -20,6 +19,7 @@ Classifier: Programming Language :: Python :: 3.9
20
19
  Classifier: Programming Language :: Python :: 3.10
21
20
  Classifier: Programming Language :: Python :: 3.11
22
21
  Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
23
  Classifier: Programming Language :: Python :: Implementation :: CPython
24
24
  Classifier: Programming Language :: Python :: Implementation :: PyPy
25
25
  Classifier: Topic :: Internet :: WWW/HTTP
@@ -29,7 +29,7 @@ Requires-Dist: h11>=0.8
29
29
  Requires-Dist: typing-extensions>=4.0; python_version < '3.11'
30
30
  Provides-Extra: standard
31
31
  Requires-Dist: colorama>=0.4; (sys_platform == 'win32') and extra == 'standard'
32
- Requires-Dist: httptools>=0.5.0; extra == 'standard'
32
+ Requires-Dist: httptools>=0.6.3; extra == 'standard'
33
33
  Requires-Dist: python-dotenv>=0.13; extra == 'standard'
34
34
  Requires-Dist: pyyaml>=5.1; extra == 'standard'
35
35
  Requires-Dist: uvloop!=0.15.0,!=0.15.1,>=0.14.0; (sys_platform != 'win32' and (sys_platform != 'cygwin' and platform_python_implementation != 'PyPy')) and extra == 'standard'
@@ -1,4 +1,4 @@
1
- uvicorn/__init__.py,sha256=vv20frJB2RygWYa40Tn-_aITeQZqylK1YdgUn-z3Fwk,147
1
+ uvicorn/__init__.py,sha256=W3_kBxLdT0TKiO6g5ToxBxQfeytQQHTODQQpYRjDGVU,147
2
2
  uvicorn/__main__.py,sha256=DQizy6nKP0ywhPpnCHgmRDYIMfcqZKVEzNIWQZjqtVQ,62
3
3
  uvicorn/_subprocess.py,sha256=HbfRnsCkXyg7xCWVAWWzXQTeWlvLKfTlIF5wevFBkR4,2766
4
4
  uvicorn/_types.py,sha256=TcUzCyKNq90ZX2Hxa6ce0juF558zLO_AyBB1XijnD2Y,7814
@@ -7,7 +7,7 @@ uvicorn/importer.py,sha256=nRt0QQ3qpi264-n_mR0l55C2ddM8nowTNzT1jsWaam8,1128
7
7
  uvicorn/logging.py,sha256=sg4D9lHaW_kKQj_kmP-bolbChjKfhBuihktlWp8RjSI,4236
8
8
  uvicorn/main.py,sha256=iv6ptgDBnko0W-VkHs0e3I4UrF7_5sEZrntQNKJGFNY,16915
9
9
  uvicorn/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
10
- uvicorn/server.py,sha256=pIpMlW1WMWxarhM3wuZrffX0OcTEKoZXA82oY_M25d8,12879
10
+ uvicorn/server.py,sha256=McDmVn0sBIVOzaCoKrp10oxaScD3tosoWhtsL1YldNo,13010
11
11
  uvicorn/workers.py,sha256=DukTKlrCyyvWVHbJWBJflIV2yUe-q6KaGdrEwLrNmyc,3893
12
12
  uvicorn/lifespan/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  uvicorn/lifespan/off.py,sha256=nfI6qHAUo_8-BEXMBKoHQ9wUbsXrPaXLCbDSS0vKSr8,332
@@ -26,8 +26,8 @@ uvicorn/protocols/utils.py,sha256=rCjYLd4_uwPeZkbRXQ6beCfxyI_oYpvJCwz3jEGNOiE,18
26
26
  uvicorn/protocols/http/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
27
  uvicorn/protocols/http/auto.py,sha256=YfXGyzWTaaE2p_jkTPWrJCXsxEaQnC3NK0-G7Wgmnls,403
28
28
  uvicorn/protocols/http/flow_control.py,sha256=050WVg31EvPOkHwynCoMP1zXFl_vO3U4durlc5vyp4U,1701
29
- uvicorn/protocols/http/h11_impl.py,sha256=MuX72-pIyZGHDtZ75-1mveeTj6_ruL-306Ug7z0yV8w,20765
30
- uvicorn/protocols/http/httptools_impl.py,sha256=TikbbIZRFG08KTClZER47ehM1Tu8koBfT6WGU5t5ACg,21491
29
+ uvicorn/protocols/http/h11_impl.py,sha256=4b-KswK57FBaRPeHXlK_oy8pKM6vG1haALCIeRH-1bA,20694
30
+ uvicorn/protocols/http/httptools_impl.py,sha256=tuQBCiD6rf5DQeyQwHVc45rxH9ouojMpkXi9KG6NRBk,21805
31
31
  uvicorn/protocols/websockets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
32
  uvicorn/protocols/websockets/auto.py,sha256=kNP-h07ZzjA9dKRUd7MNO0J7xhRJ5xVBfit7wCbdB0A,574
33
33
  uvicorn/protocols/websockets/websockets_impl.py,sha256=LV58OW3whQAd4iwbJl4R3iIod8myVYK3IhAn6F5VeZ4,15490
@@ -38,8 +38,8 @@ uvicorn/supervisors/multiprocess.py,sha256=Opt0XvOUj1DIMXYwb4OlkJZxeh_RjweFnTmDP
38
38
  uvicorn/supervisors/statreload.py,sha256=gc-HUB44f811PvxD_ZIEQYenM7mWmhQQjYg7KKQ1c5o,1542
39
39
  uvicorn/supervisors/watchfilesreload.py,sha256=41FGNMXPKrKvPr-5O8yRWg43l6OCBtapt39M-gpdk0E,3010
40
40
  uvicorn/supervisors/watchgodreload.py,sha256=kd-gOvp14ArTNIc206Nt5CEjZZ4NP2UmMVYE7571yRQ,5486
41
- uvicorn-0.31.1.dist-info/METADATA,sha256=ClTG1r-p8xfowikO16LdWLojw-qLIdv4VC9UsPP0KjE,6569
42
- uvicorn-0.31.1.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
43
- uvicorn-0.31.1.dist-info/entry_points.txt,sha256=FW1w-hkc9QgwaGoovMvm0ZY73w_NcycWdGAUfDsNGxw,46
44
- uvicorn-0.31.1.dist-info/licenses/LICENSE.md,sha256=7-Gs8-YvuZwoiw7HPlp3O3Jo70Mg_nV-qZQhTktjw3E,1526
45
- uvicorn-0.31.1.dist-info/RECORD,,
41
+ uvicorn-0.32.1.dist-info/METADATA,sha256=nLK_Q7qPiHaZyH1sD1w3_s6j58vWZ73Lu6PNuxBGrIs,6584
42
+ uvicorn-0.32.1.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
43
+ uvicorn-0.32.1.dist-info/entry_points.txt,sha256=FW1w-hkc9QgwaGoovMvm0ZY73w_NcycWdGAUfDsNGxw,46
44
+ uvicorn-0.32.1.dist-info/licenses/LICENSE.md,sha256=7-Gs8-YvuZwoiw7HPlp3O3Jo70Mg_nV-qZQhTktjw3E,1526
45
+ uvicorn-0.32.1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.25.0
2
+ Generator: hatchling 1.26.3
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any