Closed lrstanley closed 6 years ago
Yes, this didn't receive much attention when I developed it because there aren't many http clients without gzip support that I really cared about. It will be fixed if the performance overhead for the check is negligible.
There are still a huge list of popular http clients which will not decompress gzip (or other compression methods) when gzip is enabled without requesting it.
The check should be negligible. At minimum, this should be documented for those who enable the option without knowing that the library incorrectly handles gzip compression. When even curl
cannot properly parse a request, that seems like a huge issue. If those are the types of http clients that you don't "really care about", then this library may not be suited for anything production related.
I think it's an overstatement to say curl
support is "important". However, I can see where you're coming from.
I don't think curl
support is "important". Rather, there should be no favoritism between clients. curl
is one of the most popular cli-based http clients, especially for anything API related. It's one of the first used tools for many developers against an http endpoint. Even moreso in the event of troubleshooting (how I ended up finding this issue).
If this library is meant to only support specific clients or a very specific purpose (reminds me of the "this website was built for IE" days..), I would recommend updating the README to warn people of this.
I personally find it unacceptable for clients to not automatically apply gzip decompression when they actually support it. One of the main software quality factors is the ability to be robust, that includes auto-correction. Even if I send "no gzip" to a server and the server responds with a gzip response, the client should not be stubborn and just decode it automatically (curl supports it via flag, so why isn't this automatically applied?).
Nonetheless I see your point. I'll try to fix it once I find some free time.
Thanks for the detailed bug report.
This is now fixed in 28ffbafb88a643f991ab915df0e685809fd867f9.
Thank you!
It looks as though when gzip is enabled in the configuration options, gzip is enabled blindly for all responses without properly checking the
Accept-Encoding
http headers.Since there are many applications and utilities which do not fully implement the most common compression algorithms, I strongly urge adding in a check that only compresses when the client can accept it. If other compression algorithms are used by this library, I would recommend checking those too. I do not use this library myself, so I do not have first hand experience with what aero supports.
For example,
curl
by default doesn't do compression, and will only decompressgzip
content when thecompressed
flag is specified (at least on my system.)Using the
--compressed
curl flag:An example of
gunzip
'ing the output, when curl isn't told it should be requesting compression..At this time, it's unlikely servers running aero will properly work with legacy/older/more basic clients.