Closed
Description
Long story short
call set_compression() on a response object and return it to aiohttp server causes a RuntimeError ("Using chunked encoding is forbidden for HTTP/1.0")
Expected behaviour
There should be at least two ways to use compression on HTTP/1.0:
- Fully compress the content, and return the length of the compressed data in the Content-Length header;
- Do not return Content-Length header, return the compressed stream and set Connection: close. Close the connection after transmit.
Actual behaviour
An runtime error is raised, and the connection is closed immediately.
In fact, it seems that by default, even a HTTP/1.1 request is responded with a HTTP/1.0 response, so it always raises this exception.
Steps to reproduce
Call enable_compression on any response object before returning.
Comment
I think it is absolutely not correct to enable chunked encoding on compression. Content-Encoding is not a part of transfer, it is a part of the content. It should never affect the transfer encoding type.