Skip to content

Commit 1821e96

Browse files
committed
[GR-18163] Let Net::HTTP handle decompression when downloading the gem versions index
PullRequest: truffleruby/2183
2 parents c1651e7 + 491fa3a commit 1821e96

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/mri/bundler/compact_index_client/updater.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,17 @@ def update(local_path, remote_path, retrying = nil)
4747
end
4848
else
4949
# Fastly ignores Range when Accept-Encoding: gzip is set
50-
headers["Accept-Encoding"] = "gzip"
50+
unless defined?(::TruffleRuby) # let Net::HTTP handle decompression, which is more memory efficient
51+
headers["Accept-Encoding"] = "gzip"
52+
end
5153
end
5254

5355
response = @fetcher.call(remote_path, headers)
5456
return nil if response.is_a?(Net::HTTPNotModified)
5557

5658
content = response.body
5759
if response["Content-Encoding"] == "gzip"
60+
warn "Net::HTTP should have decompressed a gzip-encoded body" if defined?(::TruffleRuby)
5861
content = Zlib::GzipReader.new(StringIO.new(content)).read
5962
end
6063

0 commit comments

Comments
 (0)