3 ms·
This appears to be documented[1] behavior for Ruby. Here's a quote about the header string specifically: "If initheader doesn't have the key 'accept-encoding'
by randomdrake 13y ago
This appears to be documented[1] behavior for Ruby.
Here's a quote about the header string specifically:
"If initheader doesn't have the key 'accept-encoding', then a value of "gzip;q=1.0,deflate;q=0.6,identity;q=0.3" is used, so that gzip compression is used in preference to deflate compression, which is used in preference to no compression. Ruby doesn't have libraries to support the compress (Lempel-Ziv) compression, so that is not supported. The intent of this is to reduce bandwidth by default."
I'm not involved in Ruby / Rails development, but it's interesting to note that there was a pull request[2] on the Rails core about enabling gzip compression by default. It was ultimately decided best left up to the webserver and closed with the following quote:
"Rails should focus on being an MVC.
Enabling Gzip was an idea, but I think we now have enough arguments to not implement it ;)
IMO feature closed"
This looks like one of those good arguments. From what I can tell, this isn't a Rails problem, but a Ruby problem. I happen to agree that enabling gzip compression is good practice, but I don't think it should default to enabled at the application layer.
[1] - http://ruby-doc.org/stdlib-2.1.0/libdoc/net/http/rdoc/Net/HTTP.html#class-Net::HTTP-label-Compression http://ruby-doc.org/stdlib-2.1.0/libdoc/net/http/rdoc/Net/HT...
[2] - https://github.com/rails/rails/pull/7327 https://github.com/rails/rails/pull/7327
- kesor 13y agoThe pull request about Rails gzip compression talks about compressing http responses from Rails. While the blog post above, and the Ruby documentation of Net::HTTP, are talking about Ruby's new shiny default of compressing http requests (without care of the compressed response). Other than including the words 'gzip compression' the two topics are very different.