欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

aiohttp上报:Got more than 8190 bytes (10160) when reading Status line is too long.错误的解决办法

程序员文章站 2022-06-27 21:46:25
通过浏览器向web服务传递base64码的图片时遇到参数过长的问题? 解决办法:查看aiohttp的源码:aiohttp/http_parser.py下找到: class HeadersParser: def __init__(self, max_line_size: int=8190, max_h ......

通过浏览器向web服务传递base64码的图片时遇到参数过长的问题?

解决办法:查看aiohttp的源码:aiohttp/http_parser.py下找到:

class headersparser:
def __init__(self,
max_line_size: int=8190,
max_headers: int=32768,
max_field_size: int=8190) -> none:
self.max_line_size = max_line_size
self.max_headers = max_headers
self.max_field_size = max_field_size

修改为:

class headersparser:
def __init__(self,
max_line_size: int=81900,
max_headers: int=32768,
max_field_size: int=81900) -> none:
self.max_line_size = max_line_size
self.max_headers = max_headers
self.max_field_size = max_field_size

def parse_headers(
self,
lines: list[bytes]
) -> tuple['cimultidictproxy[str]', rawheaders]:
headers = cimultidict() # type: cimultidict[str]
raw_headers = []

lines_idx = 1
line = lines[1]
line_count = len(lines)

def parse_headers(
self,
lines: list[bytes]
) -> tuple['cimultidictproxy[str]', rawheaders]:
headers = cimultidict() # type: cimultidict[str]
raw_headers = []

lines_idx = 1
line = lines[1]
line_count = len(lines)

可以按照自己想要的长度修改max_field_size和max_line_size的值