summaryrefslogtreecommitdiff
path: root/lib/rubygems/remote_fetcher.rb
diff options
context:
space:
mode:
authorDavid Rodríguez <[email protected]>2023-01-29 21:24:11 +0100
committerHiroshi SHIBATA <[email protected]>2023-12-13 12:16:55 +0900
commitce924ce1fb029f19fd34a43f2012a485f4f62b53 ()
tree85a74c778127dc532651fcd303d1720c99bbaf48 /lib/rubygems/remote_fetcher.rb
parent6cefad77042ee3277488f56e8046c53f5313a82f (diff)
[rubygems/rubygems] Vendor net-http and net-protocol in RubyGems
https://.com/rubygems/rubygems/commit/99d91c9ed2
-rw-r--r--lib/rubygems/remote_fetcher.rb14
1 files changed, 7 insertions, 7 deletions
@@ -74,7 +74,7 @@ class Gem::RemoteFetcher
def initialize(proxy=nil, dns=nil, headers={})
require_relative "core_ext/tcpsocket_init" if Gem.configuration.ipv4_fallback_enabled
- require "net/http"
require "stringio"
require "uri"
@@ -210,17 +210,17 @@ class Gem::RemoteFetcher
# HTTP Fetcher. Dised by +fetch_path+. Use it instead.
def fetch_http(uri, last_modified = nil, head = false, depth = 0)
- fetch_type = head ? Net::HTTP::Head : Net::HTTP::Get
response = request uri, fetch_type, last_modified do |req|
headers.each {|k,v| req.add_field(k,v) }
end
case response
- when Net::HTTPOK, Net::HTTPNotModified then
response.uri = uri
head ? response : response.body
- when Net::HTTPMovedPermanently, Net::HTTPFound, Net::HTTPSeeOther,
- Net::HTTPTemporaryRedirect then
raise FetchError.new("too many redirects", uri) if depth > 10
unless location = response["Location"]
@@ -305,8 +305,8 @@ class Gem::RemoteFetcher
end
##
- # Performs a Net::HTTP request of type +request_class+ on +uri+ returning
- # a Net::HTTP response object. request maintains a table of persistent
# connections to reduce connect overhead.
def request(uri, request_class, last_modified = nil)