TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Do Not Upgrade Your Rails Project to Ruby 2 Before You Read This

25 pointsby avitzurelover 11 years ago

6 comments

jwise0over 11 years ago
The clickbait title is pretty obnoxious. I know that it is the current craze to style that way, but I can't help but imagine that a more helpful title would be something like: "Ruby 2 breaks existing projects by adding Accept-Encoding: gzip"...
评论 #7047752 未加载
randomdrakeover 11 years ago
This appears to be documented[1] behavior for Ruby.<p>Here&#x27;s a quote about the header string specifically:<p>&quot;If initheader doesn&#x27;t have the key &#x27;accept-encoding&#x27;, then a value of &quot;gzip;q=1.0,deflate;q=0.6,identity;q=0.3&quot; is used, so that gzip compression is used in preference to deflate compression, which is used in preference to no compression. Ruby doesn&#x27;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.&quot;<p>I&#x27;m not involved in Ruby &#x2F; Rails development, but it&#x27;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:<p>&quot;Rails should focus on being an MVC.<p>Enabling Gzip was an idea, but I think we now have enough arguments to not implement it ;)<p>IMO feature closed&quot;<p>This looks like one of those good arguments. From what I can tell, this isn&#x27;t a Rails problem, but a Ruby problem. I happen to agree that enabling gzip compression is good practice, but I don&#x27;t think it should default to enabled at the application layer.<p>[1] - <a href="http://ruby-doc.org/stdlib-2.1.0/libdoc/net/http/rdoc/Net/HTTP.html#class-Net::HTTP-label-Compression" rel="nofollow">http:&#x2F;&#x2F;ruby-doc.org&#x2F;stdlib-2.1.0&#x2F;libdoc&#x2F;net&#x2F;http&#x2F;rdoc&#x2F;Net&#x2F;HT...</a><p>[2] - <a href="https://github.com/rails/rails/pull/7327" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;rails&#x2F;rails&#x2F;pull&#x2F;7327</a>
评论 #7049580 未加载
mnarayan01over 11 years ago
What does this have to do with Rails?
veetiover 11 years ago
So, did you file a bug with Ruby?
jimktrains2over 11 years ago
That seems like an awkward default header, especially if it&#x27;s not going to deflate it (which causes more issues such as needing the content-length header adjusted and checksums...) It just seems like a bad idea:(
评论 #7047657 未加载
static_typedover 11 years ago
Or if you are actually going to perform an upgrade, consider a move to one of the more mature, stable, secure frameworks under Python, Perl or PHP.<p>Less Rails - less fails. Simple!
评论 #7047759 未加载
评论 #7047753 未加载
评论 #7047716 未加载
评论 #7047708 未加载