summaryrefslogtreecommitdiff
path: root/lib/rubygems/remote_fetcher.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <[email protected]>2021-07-07 14:07:29 +0900
committerHiroshi SHIBATA <[email protected]>2021-07-07 15:31:52 +0900
commitc082c6eb7c786a432bea23cf78839f64585cb630 ()
treee3c608264fe03645e905fe7284d713cff87b87dd /lib/rubygems/remote_fetcher.rb
parent6e2240a2f954c84ed12357382c9c065ae4b91e11 (diff)
Sync RubyGems and Bundler with upstream
Notes: Merged: https://.com/ruby/ruby/pull/4634
-rw-r--r--lib/rubygems/remote_fetcher.rb15
1 files changed, 6 insertions, 9 deletions
@@ -4,7 +4,7 @@ require 'rubygems/request'
require 'rubygems/request/connection_pools'
require 'rubygems/s3_uri_signer'
require 'rubygems/uri_formatter'
-require 'rubygems/uri_parsing'
require 'rubygems/user_interaction'
require 'resolv'
@@ -14,15 +14,12 @@ require 'resolv'
class Gem::RemoteFetcher
include Gem::UserInteraction
- include Gem::UriParsing
##
# A FetchError exception wraps up the various possible IO and HTTP failures
# that could happen while downloading from the internet.
class FetchError < Gem::Exception
- include Gem::UriParsing
-
##
# The URI which was being accessed when the exception happened.
@@ -31,7 +28,7 @@ class Gem::RemoteFetcher
def initialize(message, uri)
super message
- uri = parse_uri(uri)
@original_uri = uri.dup
@@ -88,7 +85,7 @@ class Gem::RemoteFetcher
@proxy = proxy
@pools = {}
- @pool_lock = Mutex.new
@cert_files = Gem::Request.get_cert_files
@headers = headers
@@ -133,7 +130,7 @@ class Gem::RemoteFetcher
require "fileutils"
FileUtils.mkdir_p cache_dir rescue nil unless File.exist? cache_dir
- source_uri = parse_uri(source_uri)
scheme = source_uri.scheme
@@ -228,7 +225,7 @@ class Gem::RemoteFetcher
unless location = response['Location']
raise FetchError.new("redirecting but no redirect location was given", uri)
end
- location = parse_uri location
if https?(uri) && !https?(location)
raise FetchError.new("redirecting to non-https resource: #{location}", uri)
@@ -246,7 +243,7 @@ class Gem::RemoteFetcher
# Downloads +uri+ and returns it as a String.
def fetch_path(uri, mtime = nil, head = false)
- uri = parse_uri uri
unless uri.scheme
raise ArgumentError, "uri scheme is invalid: #{uri.scheme.inspect}"