Grade 4
This commit is contained in:
@@ -5,6 +5,7 @@ from dataclasses import dataclass
|
||||
from starlette.requests import Request
|
||||
|
||||
from .errors import error_response
|
||||
from .middleware import is_upload
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@@ -54,6 +55,9 @@ class ResourceLimitMiddleware:
|
||||
return await reject(503, 'unavailable', 'Слишком много одновременных запросов')
|
||||
self.active += 1
|
||||
try:
|
||||
# The upload endpoint authenticates and bounds its stream itself.
|
||||
if is_upload(scope['method'], scope['path']):
|
||||
return await self.app(scope, receive, send)
|
||||
length = request.headers.get('content-length')
|
||||
if length is not None:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user