-
-
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
StreamResponse + HTTP/1.0 = corrupted file #476
Comments
The only thing that the library can do is forbidding chunked encoding if HTTP version is not 1.1 |
I agree. I'm just saying that the library should do that automatically, and not let the user fall into that trap. |
@vbraun I don't follow. |
No, I thought it should just fall back to not using chunked encoding. I.e. ignore the call to |
No, without chunked encoding you should collect all sent data into buffer before generating headers. Buffering whole response body is not appropriate.
|
OK, I do know the content length, and I do want to use |
If you know content length and set up |
Fix #476: Raise RuntimeError when chunked enabled and HTTP is 1.0
I'm using StreamResponse to serve files. My code is
If I'm using wget to download the file then it works beautifully. But when I'm using Python urllib to download the file, my download is corrupted. The difference seems to be that wget can HTTP/1.1, but urllib only does HTTP/1.0. The network trace is
and Python saves everything starting at (and including) the 10000 into the file.
I think this is because
TRANSFER-ENCODING: chunked
is HTTP/1.1 only, and a HTTP/1.0 client is entirely correct in ignoring it. Aiohttp should not send chunk sizes to HTTP/1.0 clients as they almost certainly end up in the data stream.The text was updated successfully, but these errors were encountered: