Closed nagylzs closed 1 month ago
I think all you need to do is add auto_decompress=false
to the session options?
Per my last comment, I believe aiohttp
already has the feature you need, so I'm closing this. If auto_decompress=False
doesn't do the trick, please reply with more information and we can reopen. Thanks.
Is your feature request related to a problem?
I need to be able to forward a GET request to another server in an async way. I'm using
aiohttp
for this. (The server handler is tornadoweb, but that is not important detail.) From the request handler, I can do something like this:It works almost perfectly, except for one case. If the original request had
Accept-Encoding
gzip, and the remote server supports that, then the remote server returns gzipped data. However,iter_chunked
returns chunks of data that are already unzipped. This results in sending back uncompressed data with wrongContent-Length
and wrongContent-Encoding
headers, and the request fails with an exception telling that the request handler was trying to write more data thanContent-Length
.Of course, re-encoding the data could work, but then the
Content-Length
header must be deleted, and it would be a waste of resources.Describe the solution you'd like
I believe it would be very good to introduce a new streaming method something like
iter_raw_chunked
or similar. I believe that this is a real-world scenario, because it allows aiohttp to be used for forwarding requests easily.Describe alternatives you've considered
Use a different library that supports this? But I could not find any yet.
Related component
Client
Additional context
No response
Code of Conduct