-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ServerDisconnectedError if view don't read POST body #3597
Comments
GitMate.io thinks the contributor most likely able to help you is @asvetlov. Possibly related issues are #3087 (request.post() should raise HTTPRequestEntityTooLarge same as request.read()), #2895 (Raise an exception on request body reading after sending response), #2908 (How to use make_mocked_request to make a post request with body?), #394 (ServerDisconnectedError is trigger happy), and #96 (Close connection if response body is not consumed.). |
Thanks for the report! |
No, the error does not occur if change code to this: res = await client.post('/', data=BytesIO(b'*')) or to this res = await client.post('/', data=b'*') Also the error does not occur if change code to this: form_data = FormData([('file', b'*')])
res = await client.post('/', data=form_data) or to this: form_data = FormData([('file', BytesIO(b'*'))])
res = await client.post('/', data=form_data, headers={'Connection': 'close'}) |
I have found case then error is occur with raw data bytes: size = 128 * 1024 + 1
res = await client.post('/', data=BytesIO(b'*' * size))
# and without BytesIO too
res = await client.post('/', data=b'*' * size) |
Related to #5220 |
Long story short
If I use
ClientSession
with persistent connection (keep-alive) and sends two POST-requests with form-data that contains a file represented asio.BytesIO()
, andweb.Application()
don't reads body of request, then second client's request fails with exceptionServerDisconnectedError
.Steps to reproduce
Shot example to reproduce the problem:
Your environment
Ubuntu 18.04
Python 3.7.1
aiohttp 3.5.4
The text was updated successfully, but these errors were encountered: