aio-libs / aio-libs/aiohttp

Cannot easily access max_field_size in client response

Đang mở
#2,304 5 bình luận 6 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
Python
Star
16.5k
Fork
2.4k
Merge trung bình
17 giờ 22 phút
Pull request đã merge (30 ngày)
212

Mô tả

## Long story short

The http client doesn't really support overriding the default header value length of 8190, even though the parser parameter is there https://github.com/aio-libs/aiohttp/blob/e7c9390111932dd6dbb642170d7a0da1876271ec/aiohttp/http_parser.py#L59

This results in the error message:

```
aiohttp.client_exceptions.ClientResponseError: 400, message='Got more than 8190 bytes when reading Header value is too long.'
```

Stack trace from real app:
```

File "/usr/local/lib/python3.6/site-packages/pyportify/google.py", line 113, in _http_get
params=merged_params,
File "/usr/local/lib/python3.6/site-packages/aiohttp/helpers.py", line 97, in iter
ret = yield from self._coro
File "/usr/local/lib/python3.6/site-packages/aiohttp/client.py", line 241, in _request
yield from resp.start(conn, read_until_eof)
File "/usr/local/lib/python3.6/site-packages/aiohttp/client_reqrep.py", line 564, in start
message=exc.message, headers=exc.headers) from exc
aiohttp.client_exceptions.ClientResponseError: 400, message='Got more than 8190 bytes when reading Header value is too long.'
```

## Expected behaviour

I can either set the parser in the session/get request, or set the max_field_size.

## Actual behaviour

I can't do either

## Steps to reproduce
I believe this will do it:

```
import aiohttp
import asyncio

@asyncio.coroutine
def main():
with aiohttp.ClientSession() as session:
resp = yield from session.get('http://test.xr6.me')
print(len(resp.headers['X-TEST-HEADER']))
resp.close()

if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(
asyncio.gather(main())
)
loop.close()
```

## Your environment

Ubuntu jessie (bash for windows, reproduces on others though)
python3.4 (also reproduces on others)

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.