通過瀏覽器向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的值