From b69bbf588a3dd167d62dbb89f0cef25ebae4a7ea Mon Sep 17 00:00:00 2001 From: Samuel Giddins Date: Sun, 22 Oct 2023 13:25:07 -0700 Subject: [rubygems/rubygems] User bundler UA when downloading gems Gem::RemoteFetcher uses Gem::Request, which adds the RubyGems UA. Gem::RemoteFetcher is used to download gems, as well as the full index. We would like the bundler UA to be used whenever bundler is making requests. This PR also avoids unsafely mutating the headers hash on the shared `Gem::RemoteFetcher.fetcher` instance, which could cause corruption or incorrect headers when making parallel requests. Instead, we create one remote fetcher per rubygems remote, which is similar to the connection segregation bundler is already doing https://github.com/rubygems/rubygems/commit/f0e8dacdec --- lib/bundler/fetcher/index.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/bundler/fetcher/index.rb') diff --git a/lib/bundler/fetcher/index.rb b/lib/bundler/fetcher/index.rb index c623647f01..6e37e1e5d1 100644 --- a/lib/bundler/fetcher/index.rb +++ b/lib/bundler/fetcher/index.rb @@ -6,7 +6,7 @@ module Bundler class Fetcher class Index < Base def specs(_gem_names) - Bundler.rubygems.fetch_all_remote_specs(remote) + Bundler.rubygems.fetch_all_remote_specs(remote, gem_remote_fetcher) rescue Gem::RemoteFetcher::FetchError => e case e.message when /certificate verify failed/ -- cgit v1.2.3