class Bundler::Fetcher

def fetch_all_remote_specs

fetch from modern index: specs.4.8.gz
def fetch_all_remote_specs
  old_sources = Bundler.rubygems.sources
  Bundler.rubygems.sources = [@remote_uri.to_s]
  Bundler.rubygems.fetch_all_remote_specs
rescue Gem::RemoteFetcher::FetchError, OpenSSL::SSL::SSLError => e
  case e.message
  when /certificate verify failed/
    raise CertificateFailureError.new(uri)
  when /401|403/
    # Gemfury uses a 403 for unauthenticated requests instead of a 401, so retry auth
    # on both.
    retry_with_auth { fetch_all_remote_specs }
  else
    Bundler.ui.trace e
    raise HTTPError, "Could not fetch specs from #{uri}"
  end
ensure
  Bundler.rubygems.sources = old_sources
end