[Assigned] Cannot install gems from gzip-compressing gem server

Issue #9562 has been updated by Yui NARUSE.

Status changed from Open to Assigned
Assignee set to Eric H.
Target version set to current: 2.2.0
Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN to
1.9.3: DONTNEED, 2.0.0: REQUIRED, 2.1: REQUIRED

You know, since Ruby 2.0.0, net/http automatically decode
content-encoding;gzip.
Therefore Gem::Request, which uses Net::HTTP internally, also decode gz
file, for example specs.4.8.gz,
if a gemsource server sets Content-Encoding: gzip to gz files.

Individual gem servers may hit this issue if people accidentally set
Content-Encoding: gzip.
I think this issue should be avoided by RubyGems, and a patch may be
following:

diff --git a/lib/rubygems/request.rb b/lib/rubygems/request.rb
index d2f076f..588dae4 100644
--- a/lib/rubygems/request.rb
+++ b/lib/rubygems/request.rb
@@ -112,6 +112,7 @@ class Gem::Request
request.add_field 'User-Agent', @user_agent
request.add_field 'Connection', 'keep-alive'
request.add_field 'Keep-Alive', '30'
+    request.add_field 'Accept-Encoding', ''
if @last_modified then
request.add_field 'If-Modified-Since', @last_modified.httpdate

Bug #9562: Cannot install gems from gzip-compressing gem server

  • Author: 5 5
  • Status: Assigned
  • Priority: Normal
  • Assignee: Eric H.
  • Category: lib/rubygems
  • Target version: current: 2.2.0
  • ruby -v: ruby 2.0.0p353 (2013-11-22) [i386-mingw32]
  • Backport: 1.9.3: DONTNEED, 2.0.0: REQUIRED, 2.1: REQUIRED