stop handing out Request Entity Too Large errors
This commit is contained in:
parent
695c7145af
commit
00c30d2af0
4
app.py
4
app.py
|
@ -4,6 +4,7 @@
|
|||
import io
|
||||
import os
|
||||
import sys
|
||||
import utils
|
||||
import random
|
||||
import asyncio
|
||||
import aiohttp
|
||||
|
@ -60,7 +61,8 @@ async def handler(request):
|
|||
return resp
|
||||
|
||||
async def amain():
|
||||
srv = web.Server(handler)
|
||||
# It's not our job to hand out 413s, that's the job of upstream and downstream
|
||||
srv = web.Server(handler, request_factory=utils.make_unlimited_request)
|
||||
runner = web.ServerRunner(srv)
|
||||
await runner.setup()
|
||||
bind = os.path.expandvars(config['bind'])
|
||||
|
|
5
utils.py
5
utils.py
|
@ -1,8 +1,10 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import random
|
||||
import asyncio
|
||||
import contextlib
|
||||
import contextvars
|
||||
from aiohttp import web
|
||||
|
||||
class ContextVar:
|
||||
"""
|
||||
|
@ -32,3 +34,6 @@ def build_dprint(debug: bool):
|
|||
return lambda *args, **kwargs: None
|
||||
|
||||
return dprint
|
||||
|
||||
def make_unlimited_request(*args):
|
||||
return web.BaseRequest(*args, loop=asyncio.get_running_loop(), client_max_size=None)
|
||||
|
|
Loading…
Reference in New Issue