复现方式
Server Code
import bottle
app = bottle.Bottle()
@app.get('/')
def index():
bottle.response.set_cookie("a" * 10000, "test")
return 'ok'
app.run()
Client Code
import asyncio
from aiohttp import ClientSession
async def main():
async with ClientSession() as req:
async with req.get('http://127.0.0.1:8080/') as r:
print(await r.text())
asyncio.run(main())
报错就是
aiohttp.client_exceptions.ClientResponseError: 400, message='Got more than 8190 bytes (10005) when reading request header field Set-Cookie.', url=URL('http://127.0.0.1:8080/')
尝试
简单的 patch 一个类的方法, 改掉默认值. 失败, 因为这是 C 实现的...
https://github.com/aio-libs/aiohttp/search?q=max_field_size+&type=
基本全是写死的常量默认值
另:
基本又是一个 aiohttp 独占的报错, 浏览器 / httpx / Requests 都没这问题.