通过浏览器向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的值

05-26 22:24