Default to no maximum request size for streaming handlers.
This commit is contained in:
parent
eb66621544
commit
730de6afda
13
sanic/app.py
13
sanic/app.py
|
@ -993,12 +993,13 @@ class Sanic:
|
||||||
# Fetch handler from router
|
# Fetch handler from router
|
||||||
handler, args, kwargs, uri, name = self.router.get(request)
|
handler, args, kwargs, uri, name = self.router.get(request)
|
||||||
|
|
||||||
# Non-streaming handlers have their body preloaded
|
if request.stream.request_body:
|
||||||
if (
|
if self.router.is_stream_handler(request):
|
||||||
request.stream.request_body
|
# Streaming handler: lift the size limit
|
||||||
and not self.router.is_stream_handler(request)
|
request.stream.request_max_size = float("inf")
|
||||||
):
|
else:
|
||||||
await request.receive_body()
|
# Non-streaming handler: preload body
|
||||||
|
await request.receive_body()
|
||||||
|
|
||||||
# -------------------------------------------- #
|
# -------------------------------------------- #
|
||||||
# Request Middleware
|
# Request Middleware
|
||||||
|
|
Loading…
Reference in New Issue
Block a user