-
Notifications
You must be signed in to change notification settings - Fork 325
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
Fix gzhttp transport response. #977
Conversation
1. Fix response header Content-Encoding: gzip,zstd but not decompress 2. Server side Content-Encoding is not controlled. Fix the decompression problem when Content-Encoding appears gzip and zstd at the same time
Could you please explain a bit deeper. Perhaps with an example. Note that we do not decompress if we did not ourselves add the Without more context I think you are breaking a lot of existing use of this package. |
I am implementing a caching middleware, and during use I found that when saving files locally, gzip data that could not be decompressed appeared. If the data returned through the gzhttp transport middleware needs to be processed and decompressed gzip a second time. If it can't solve the data perfectly, then what's the point of this middleware's existence? |
When accessing an uncertain backend HTTP Server, there is no guarantee that the backend server will fully comply with HTTP standards. There may be some data that does not meet the standards. At this time, the data needs to be processed. The PR I submitted is to solve this problem. If there is a problem with my code, please reject my PR and I will continue to improve it. |
There can be plenty of reasons. A) If "Accept-Encoding" is added upstream, we do not touch the request or the response. Since you don't really provide any information, I am assuming it is B). I can add an option that will allow for that. |
Thanks. I think the option is feasible. |
Looking forward to your code. |
TransportAlwaysDecompress will always decompress the response, regardless of whether we requested it or not. Default is false, which will pass compressed data through if we did not request compression. Replaces #977 Bonus: Remove code for Go 1.19 and older.
See #978 |
* Add TransportAlwaysDecompress option. TransportAlwaysDecompress will always decompress the response, regardless of whether we requested it or not. Default is false, which will pass compressed data through if we did not request compression. Replaces #977 Bonus: Remove code for Go 1.19 and older.
Fix the decompression problem when Content-Encoding appears gzip and zstd at the same time