summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Rodríguez <[email protected]>2024-01-15 20:51:02 +0100
committerHiroshi SHIBATA <[email protected]>2024-01-29 12:14:21 +0900
commitd64d0b54231208c7bec899a7fe8c3b98ec2e9a1b ()
tree9d18dbdda185bda6ccaf1f5a710f678dddbc907f /lib
parent6bbbfb4629a4fdb336d5ac4f625e97ce30c15a01 (diff)
Vendor uri gem in RubyGems
-rw-r--r--lib/rubygems/commands/sources_command.rb4
-rw-r--r--lib/rubygems/gemcutter_utilities.rb10
-rw-r--r--lib/rubygems/gemcutter_utilities/webauthn_listener.rb2
-rw-r--r--lib/rubygems/local_remote_options.rb12
-rw-r--r--lib/rubygems/net-http/lib/net/http.rb30
-rw-r--r--lib/rubygems/net-http/lib/net/http/generic_request.rb18
-rw-r--r--lib/rubygems/net-http/lib/net/http/header.rb4
-rw-r--r--lib/rubygems/net-http/lib/net/http/request.rb4
-rw-r--r--lib/rubygems/net-http/lib/net/http/requests.rb30
-rw-r--r--lib/rubygems/net-http/lib/net/http/response.rb4
-rw-r--r--lib/rubygems/net-http/lib/net/http/responses.rb12
-rw-r--r--lib/rubygems/net-http/lib/net/http/status.rb2
-rw-r--r--lib/rubygems/optparse/lib/optparse.rb2
-rw-r--r--lib/rubygems/optparse/lib/optparse/uri.rb4
-rw-r--r--lib/rubygems/remote_fetcher.rb4
-rw-r--r--lib/rubygems/request.rb8
-rw-r--r--lib/rubygems/resolver/api_set.rb2
-rw-r--r--lib/rubygems/resolver/best_set.rb2
-rw-r--r--lib/rubygems/s3_uri_signer.rb4
-rw-r--r--lib/rubygems/source/git.rb4
-rw-r--r--lib/rubygems/source_list.rb2
-rw-r--r--lib/rubygems/specification_policy.rb8
-rw-r--r--lib/rubygems/uri.rb12
-rw-r--r--lib/rubygems/util.rb2
-rw-r--r--lib/rubygems/vendor/uri/.document1
-rw-r--r--lib/rubygems/vendor/uri/LICENSE.txt22
-rw-r--r--lib/rubygems/vendor/uri/lib/uri.rb104
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/common.rb853
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/file.rb100
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/ftp.rb267
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/generic.rb1588
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/http.rb125
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/https.rb23
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/ldap.rb261
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/ldaps.rb22
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/mailto.rb293
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/rfc2396_parser.rb539
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/rfc3986_parser.rb183
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/version.rb6
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/ws.rb83
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/wss.rb23
41 files changed, 4586 insertions, 93 deletions
@@ -59,7 +59,7 @@ class Gem::Commands::SourcesCommand < Gem::Command
say "#{source_uri} added to sources"
end
- rescue URI::Error, ArgumentError
say "#{source_uri} is not a URI"
terminate_interaction 1
rescue Gem::RemoteFetcher::FetchError => e
@@ -81,7 +81,7 @@ Do you want to add this source?
end
def check_rubygems_https(source_uri) # :nodoc:
- uri = URI source_uri
if uri.scheme && uri.scheme.casecmp("http").zero? &&
uri.host.casecmp("rubygems.org").zero?
@@ -93,8 +93,8 @@ module Gem::GemcutterUtilities
end
if allowed_push_host
- allowed_host_uri = URI.parse(allowed_push_host)
- host_uri = URI.parse(self.host)
unless (host_uri.scheme == allowed_host_uri.scheme) && (host_uri.host == allowed_host_uri.host)
alert_error "#{self.host.inspect} is not allowed by the gemspec, which only allows #{allowed_push_host.inspect}"
@@ -102,7 +102,7 @@ module Gem::GemcutterUtilities
end
end
- uri = URI.parse "#{self.host}/#{path}"
response = request_with_otp(method, uri, &block)
if mfa_unauthorized?(response)
@@ -136,7 +136,7 @@ module Gem::GemcutterUtilities
sign_in_host, scope: scope) do |request|
request.basic_auth email, password
request["OTP"] = otp if otp
- request.body = URI.encode_www_form({ api_key: api_key }.merge(update_scope_params))
end
with_response response do |_resp|
@@ -176,7 +176,7 @@ module Gem::GemcutterUtilities
sign_in_host, credentials: credentials, scope: scope) do |request|
request.basic_auth email, password
request["OTP"] = otp if otp
- request.body = URI.encode_www_form({ name: key_name }.merge(all_params))
end
with_response response do |resp|
@@ -51,7 +51,7 @@ module Gem::GemcutterUtilities
request_line = socket.gets
method, req_uri, _protocol = request_line.split(" ")
- req_uri = URI.parse(req_uri)
responder = SocketResponder.new(socket)
@@ -6,7 +6,7 @@
# See LICENSE.txt for permissions.
#++
-require "uri"
require_relative "../rubygems"
##
@@ -17,10 +17,10 @@ module Gem::LocalRemoteOptions
# Allows Gem::OptionParser to handle HTTP URIs.
def accept_uri_http
- Gem::OptionParser.accept URI::HTTP do |value|
begin
- uri = URI.parse value
- rescue URI::InvalidURIError
raise Gem::OptionParser::InvalidArgument, value
end
@@ -88,7 +88,7 @@ module Gem::LocalRemoteOptions
def add_proxy_option
accept_uri_http
- add_option(:"Local/Remote", "-p", "--[no-]http-proxy [URL]", URI::HTTP,
"Use HTTP proxy for remote operations") do |value, options|
options[:http_proxy] = value == false ? :no_proxy : value
Gem.configuration[:http_proxy] = options[:http_proxy]
@@ -101,7 +101,7 @@ module Gem::LocalRemoteOptions
def add_source_option
accept_uri_http
- add_option(:"Local/Remote", "-s", "--source URL", URI::HTTP,
"Append URL to list of remote gem sources") do |source, options|
source << "/" unless source.end_with?("/")
@@ -21,7 +21,7 @@
#
require_relative '../../../net-protocol/lib/net/protocol'
-require 'uri'
require_relative '../../../resolv/lib/resolv'
autoload :OpenSSL, 'openssl'
@@ -106,20 +106,20 @@ module Gem::Net #:nodoc:
# It consists of some or all of: scheme, hostname, path, query, and fragment;
# see {URI syntax}[https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Syntax].
#
- # A Ruby {URI::Generic}[rdoc-ref:URI::Generic] object
# represents an internet URI.
# It provides, among others, methods
# +scheme+, +hostname+, +path+, +query+, and +fragment+.
#
# === Schemes
#
- # An internet \URI has
# a {scheme}[https://en.wikipedia.org/wiki/List_of_URI_schemes].
#
# The two schemes supported in \Gem::Net::HTTP are <tt>'https'</tt> and <tt>'http'</tt>:
#
# uri.scheme # => "https"
- # URI('http://example.com').scheme # => "http"
#
# === Hostnames
#
@@ -146,8 +146,8 @@ module Gem::Net #:nodoc:
#
# _uri = uri.dup
# params = {userId: 1, completed: false}
- # _uri.query = URI.encode_www_form(params)
- # _uri # => #<URI::HTTPS https://jsonplaceholder.typicode.com?userId=1&completed=false>
# Gem::Net::HTTP.get(_uri)
#
# === Fragments
@@ -273,7 +273,7 @@ module Gem::Net #:nodoc:
# # You should choose a better exception.
# raise ArgumentError, 'Too many HTTP redirects' if limit == 0
#
- # res = Gem::Net::HTTP.get_response(URI(uri))
# case res
# when Gem::Net::HTTPSuccess # Any success class.
# res
@@ -327,9 +327,9 @@ module Gem::Net #:nodoc:
#
# Or if you simply want to make a GET request, you may pass in a URI
# object that has an \HTTPS URL. \Gem::Net::HTTP automatically turns on TLS
- # verification if the URI object has a 'https' URI scheme:
#
- # uri # => #<URI::HTTPS https://jsonplaceholder.typicode.com/>
# Gem::Net::HTTP.get(uri)
#
# == Proxy Server
@@ -371,9 +371,9 @@ module Gem::Net #:nodoc:
# === Proxy Using '<tt>ENV['http_proxy']</tt>'
#
# When environment variable <tt>'http_proxy'</tt>
- # is set to a \URI string,
# the returned +http+ will have the server at that URI as its proxy;
- # note that the \URI string must have a protocol
# such as <tt>'http'</tt> or <tt>'https'</tt>:
#
# ENV['http_proxy'] = 'http://example.com'
@@ -386,7 +386,7 @@ module Gem::Net #:nodoc:
# http.proxy_user # => nil
# http.proxy_pass # => nil
#
- # The \URI string may include proxy username, password, and port number:
#
# ENV['http_proxy'] = 'http://pname:[email protected]:8000'
# http = Gem::Net::HTTP.new(hostname)
@@ -790,7 +790,7 @@ module Gem::Net #:nodoc:
#
# With URI object +uri+ and optional hash argument +headers+:
#
- # uri = URI('https://jsonplaceholder.typicode.com/todos/1')
# headers = {'Content-type' => 'application/json; charset=UTF-8'}
# Gem::Net::HTTP.get(uri, headers)
#
@@ -1074,7 +1074,7 @@ module Gem::Net #:nodoc:
elsif p_addr == :ENV then
http.proxy_from_env = true
else
- if p_addr && p_no_proxy && !URI::Generic.use_proxy?(address, address, port, p_no_proxy)
p_addr = nil
p_port = nil
end
@@ -1796,7 +1796,7 @@ module Gem::Net #:nodoc:
# The proxy URI determined from the environment for this connection.
def proxy_uri # :nodoc:
return if @proxy_uri == false
- @proxy_uri ||= URI::HTTP.new(
"http", nil, address, port, nil, nil, nil, nil, nil
).find_proxy || false
@proxy_uri || nil
@@ -17,10 +17,10 @@ class Gem::Net::HTTPGenericRequest
@request_has_body = reqbody
@response_has_body = resbody
- if URI === uri_or_path then
- raise ArgumentError, "not an HTTP URI" unless URI::HTTP === uri_or_path
hostname = uri_or_path.hostname
- raise ArgumentError, "no host component for URI" unless (hostname && hostname.length > 0)
@uri = uri_or_path.dup
host = @uri.hostname.dup
host << ":" << @uri.port.to_s if @uri.port != @uri.default_port
@@ -71,10 +71,10 @@ class Gem::Net::HTTPGenericRequest
#
attr_reader :path
- # Returns the URI object for the request, or +nil+ if none:
#
# Gem::Net::HTTP::Get.new(uri).uri
- # # => #<URI::HTTPS https://jsonplaceholder.typicode.com/>
# Gem::Net::HTTP::Get.new('example.com').uri # => nil
#
attr_reader :uri
@@ -213,10 +213,10 @@ class Gem::Net::HTTPGenericRequest
if ssl
scheme = 'https'
- klass = URI::HTTPS
else
scheme = 'http'
- klass = URI::HTTP
end
if host = self['host']
@@ -225,7 +225,7 @@ class Gem::Net::HTTPGenericRequest
else
host = addr
end
- # convert the class of the URI
if @uri.is_a?(klass)
@uri.host = host
@uri.port = port
@@ -286,7 +286,7 @@ class Gem::Net::HTTPGenericRequest
def send_request_with_body_data(sock, ver, path, params)
if /\Amultipart\/form-data\z/i !~ self.content_type
self.content_type = 'application/x-www-form-urlencoded'
- return send_request_with_body(sock, ver, path, URI.encode_www_form(params))
end
opt = @form_option.dup
@@ -782,7 +782,7 @@ module Gem::Net::HTTPHeader
# The resulting request is suitable for HTTP request +POST+ or +PUT+.
#
# Argument +params+ must be suitable for use as argument +enum+ to
- # {URI.encode_www_form}[https://docs.ruby-lang.org/en/master/URI.html#method-c-encode_www_form].
#
# With only argument +params+ given,
# sets the body to a URL-encoded string with the default separator <tt>'&'</tt>:
@@ -810,7 +810,7 @@ module Gem::Net::HTTPHeader
#
# Gem::Net::HTTPHeader#form_data= is an alias for Gem::Net::HTTPHeader#set_form_data.
def set_form_data(params, sep = '&')
- query = URI.encode_www_form(params)
query.gsub!(/&/, sep) if sep != '&'
self.body = query
self.content_type = 'application/x-www-form-urlencoded'
@@ -6,10 +6,10 @@
#
# == Creating a Request
#
-# An request object may be created with either a URI or a string hostname:
#
# require 'rubygems/net-http/lib/net/http'
-# uri = URI('https://jsonplaceholder.typicode.com/')
# req = Gem::Net::HTTP::Get.new(uri) # => #<Gem::Net::HTTP::Get GET>
# req = Gem::Net::HTTP::Get.new(uri.hostname) # => #<Gem::Net::HTTP::Get GET>
#
@@ -6,7 +6,7 @@
# {HTTP method GET}[https://en.wikipedia.org/w/index.php?title=Hypertext_Transfer_Protocol#GET_method]:
#
# require 'rubygems/net-http/lib/net/http'
-# uri = URI('http://example.com')
# hostname = uri.hostname # => "example.com"
# req = Gem::Net::HTTP::Get.new(uri) # => #<Gem::Net::HTTP::Get GET>
# res = Gem::Net::HTTP.start(hostname) do |http|
@@ -38,7 +38,7 @@ end
# {HTTP method HEAD}[https://en.wikipedia.org/w/index.php?title=Hypertext_Transfer_Protocol#HEAD_method]:
#
# require 'rubygems/net-http/lib/net/http'
-# uri = URI('http://example.com')
# hostname = uri.hostname # => "example.com"
# req = Gem::Net::HTTP::Head.new(uri) # => #<Gem::Net::HTTP::Head HEAD>
# res = Gem::Net::HTTP.start(hostname) do |http|
@@ -69,7 +69,7 @@ end
# {HTTP method POST}[https://en.wikipedia.org/w/index.php?title=Hypertext_Transfer_Protocol#POST_method]:
#
# require 'rubygems/net-http/lib/net/http'
-# uri = URI('http://example.com')
# hostname = uri.hostname # => "example.com"
# uri.path = '/posts'
# req = Gem::Net::HTTP::Post.new(uri) # => #<Gem::Net::HTTP::Post POST>
@@ -104,7 +104,7 @@ end
# {HTTP method PUT}[https://en.wikipedia.org/w/index.php?title=Hypertext_Transfer_Protocol#PUT_method]:
#
# require 'rubygems/net-http/lib/net/http'
-# uri = URI('http://example.com')
# hostname = uri.hostname # => "example.com"
# uri.path = '/posts'
# req = Gem::Net::HTTP::Put.new(uri) # => #<Gem::Net::HTTP::Put PUT>
@@ -134,7 +134,7 @@ end
# {HTTP method DELETE}[https://en.wikipedia.org/w/index.php?title=Hypertext_Transfer_Protocol#DELETE_method]:
#
# require 'rubygems/net-http/lib/net/http'
-# uri = URI('http://example.com')
# hostname = uri.hostname # => "example.com"
# uri.path = '/posts/1'
# req = Gem::Net::HTTP::Delete.new(uri) # => #<Gem::Net::HTTP::Delete DELETE>
@@ -166,7 +166,7 @@ end
# {HTTP method OPTIONS}[https://en.wikipedia.org/w/index.php?title=Hypertext_Transfer_Protocol#OPTIONS_method]:
#
# require 'rubygems/net-http/lib/net/http'
-# uri = URI('http://example.com')
# hostname = uri.hostname # => "example.com"
# req = Gem::Net::HTTP::Options.new(uri) # => #<Gem::Net::HTTP::Options OPTIONS>
# res = Gem::Net::HTTP.start(hostname) do |http|
@@ -197,7 +197,7 @@ end
# {HTTP method TRACE}[https://en.wikipedia.org/w/index.php?title=Hypertext_Transfer_Protocol#TRACE_method]:
#
# require 'rubygems/net-http/lib/net/http'
-# uri = URI('http://example.com')
# hostname = uri.hostname # => "example.com"
# req = Gem::Net::HTTP::Trace.new(uri) # => #<Gem::Net::HTTP::Trace TRACE>
# res = Gem::Net::HTTP.start(hostname) do |http|
@@ -228,7 +228,7 @@ end
# {HTTP method }[https://en.wikipedia.org/w/index.php?title=Hypertext_Transfer_Protocol#_method]:
#
# require 'rubygems/net-http/lib/net/http'
-# uri = URI('http://example.com')
# hostname = uri.hostname # => "example.com"
# uri.path = '/posts'
# req = Gem::Net::HTTP::.new(uri) # => #<Gem::Net::HTTP:: >
@@ -266,7 +266,7 @@ end
# {WebDAV method PROPFIND}[http://www.webdav.org/specs/rfc4918.html#METHOD_PROPFIND]:
#
# require 'rubygems/net-http/lib/net/http'
-# uri = URI('http://example.com')
# hostname = uri.hostname # => "example.com"
# req = Gem::Net::HTTP::Propfind.new(uri) # => #<Gem::Net::HTTP::Propfind PROPFIND>
# res = Gem::Net::HTTP.start(hostname) do |http|
@@ -289,7 +289,7 @@ end
# {WebDAV method PROP}[http://www.webdav.org/specs/rfc4918.html#METHOD_PROP]:
#
# require 'rubygems/net-http/lib/net/http'
-# uri = URI('http://example.com')
# hostname = uri.hostname # => "example.com"
# req = Gem::Net::HTTP::Prop.new(uri) # => #<Gem::Net::HTTP::Prop PROP>
# res = Gem::Net::HTTP.start(hostname) do |http|
@@ -312,7 +312,7 @@ end
# {WebDAV method MKCOL}[http://www.webdav.org/specs/rfc4918.html#METHOD_MKCOL]:
#
# require 'rubygems/net-http/lib/net/http'
-# uri = URI('http://example.com')
# hostname = uri.hostname # => "example.com"
# req = Gem::Net::HTTP::Mkcol.new(uri) # => #<Gem::Net::HTTP::Mkcol MKCOL>
# res = Gem::Net::HTTP.start(hostname) do |http|
@@ -335,7 +335,7 @@ end
# {WebDAV method COPY}[http://www.webdav.org/specs/rfc4918.html#METHOD_COPY]:
#
# require 'rubygems/net-http/lib/net/http'
-# uri = URI('http://example.com')
# hostname = uri.hostname # => "example.com"
# req = Gem::Net::HTTP::Copy.new(uri) # => #<Gem::Net::HTTP::Copy COPY>
# res = Gem::Net::HTTP.start(hostname) do |http|
@@ -358,7 +358,7 @@ end
# {WebDAV method MOVE}[http://www.webdav.org/specs/rfc4918.html#METHOD_MOVE]:
#
# require 'rubygems/net-http/lib/net/http'
-# uri = URI('http://example.com')
# hostname = uri.hostname # => "example.com"
# req = Gem::Net::HTTP::Move.new(uri) # => #<Gem::Net::HTTP::Move MOVE>
# res = Gem::Net::HTTP.start(hostname) do |http|
@@ -381,7 +381,7 @@ end
# {WebDAV method LOCK}[http://www.webdav.org/specs/rfc4918.html#METHOD_LOCK]:
#
# require 'rubygems/net-http/lib/net/http'
-# uri = URI('http://example.com')
# hostname = uri.hostname # => "example.com"
# req = Gem::Net::HTTP::Lock.new(uri) # => #<Gem::Net::HTTP::Lock LOCK>
# res = Gem::Net::HTTP.start(hostname) do |http|
@@ -404,7 +404,7 @@ end
# {WebDAV method UNLOCK}[http://www.webdav.org/specs/rfc4918.html#METHOD_UNLOCK]:
#
# require 'rubygems/net-http/lib/net/http'
-# uri = URI('http://example.com')
# hostname = uri.hostname # => "example.com"
# req = Gem::Net::HTTP::Unlock.new(uri) # => #<Gem::Net::HTTP::Unlock UNLOCK>
# res = Gem::Net::HTTP.start(hostname) do |http|
@@ -216,8 +216,8 @@ class Gem::Net::HTTPResponse
attr_reader :message
alias msg message # :nodoc: obsolete
- # The URI used to fetch this response. The response URI is only available
- # if a URI was used to create the request.
attr_reader :uri
# Set to true automatically when the request did not contain an
@@ -379,7 +379,7 @@ module Gem::Net
# Response class for <tt>See Other</tt> responses (status code 303).
#
- # The response to the request can be found under another URI using the GET method.
#
# :include: doc/net-http/included_getters.rdoc
#
@@ -428,8 +428,8 @@ module Gem::Net
# Response class for <tt>Temporary Redirect</tt> responses (status code 307).
#
- # The request should be repeated with another URI;
- # however, future requests should still use the original URI.
#
# :include: doc/net-http/included_getters.rdoc
#
@@ -445,7 +445,7 @@ module Gem::Net
# Response class for <tt>Permanent Redirect</tt> responses (status code 308).
#
- # This and all future requests should be directed to the given URI.
#
# :include: doc/net-http/included_getters.rdoc
#
@@ -690,9 +690,9 @@ module Gem::Net
end
HTTPRequestEntityTooLarge = HTTPPayloadTooLarge
- # Response class for <tt>URI Too Long</tt> responses (status code 414).
#
- # The URI provided was too long for the server to process.
#
# :include: doc/net-http/included_getters.rdoc
#
@@ -11,7 +11,7 @@ if $0 == __FILE__
puts
puts "Gem::Net::HTTP::STATUS_CODES = {"
url = "https://www.iana.org/assignments/http-status-codes/http-status-codes-1.csv"
- URI(url).read.each_line do |line|
code, mes, = line.split(',')
next if ['(Unused)', 'Unassigned', 'Description'].include?(mes)
puts " #{code} => '#{mes}',"
@@ -158,7 +158,7 @@
# - Date -- Anything accepted by +Date.parse+ (need to require +optparse/date+)
# - DateTime -- Anything accepted by +DateTime.parse+ (need to require +optparse/date+)
# - Time -- Anything accepted by +Time.httpdate+ or +Time.parse+ (need to require +optparse/time+)
-# - URI -- Anything accepted by +URI.parse+ (need to require +optparse/uri+)
# - Shellwords -- Anything accepted by +Shellwords.shellwords+ (need to require +optparse/shellwords+)
# - String -- Any non-empty string
# - Integer -- Any integer. Will convert octal. (e.g. 124, -3, 040)
@@ -2,6 +2,6 @@
# -*- ruby -*-
require_relative '../optparse'
-require 'uri'
-Gem::OptionParser.accept(URI) {|s,| URI.parse(s) if s}
@@ -76,7 +76,7 @@ class Gem::RemoteFetcher
require_relative "core_ext/tcpsocket_init" if Gem.configuration.ipv4_fallback_enabled
require_relative "net/http"
require "stringio"
- require "uri"
Socket.do_not_reverse_lookup = true
@@ -135,7 +135,7 @@ class Gem::RemoteFetcher
scheme = source_uri.scheme
- # URI.parse gets confused by MS Windows paths with forward slashes.
scheme = nil if /^[a-z]$/i.match?(scheme)
# REFACTOR: split this up and dis on scheme (eg download_http)
@@ -18,11 +18,11 @@ class Gem::Request
end
def self.proxy_uri(proxy) # :nodoc:
- require "uri"
case proxy
when :no_proxy then nil
- when URI::HTTP then proxy
- else URI.parse(proxy)
end
end
@@ -176,7 +176,7 @@ class Gem::Request
end
require "uri"
- uri = URI(Gem::UriFormatter.new(env_proxy).normalize)
if uri && uri.user.nil? && uri.password.nil?
user = ENV["#{downcase_scheme}_proxy_user"] || ENV["#{upcase_scheme}_PROXY_USER"]
@@ -30,7 +30,7 @@ class Gem::Resolver::APISet < Gem::Resolver::Set
def initialize(dep_uri = "https://index.rubygems.org/info/")
super()
- dep_uri = URI dep_uri unless URI === dep_uri
@dep_uri = dep_uri
@uri = dep_uri + ".."
@@ -60,7 +60,7 @@ class Gem::Resolver::BestSet < Gem::Resolver::ComposedSet
def replace_failed_api_set(error) # :nodoc:
uri = error.original_uri
- uri = URI uri unless URI === uri
uri += "."
raise error unless api_set = @sets.find do |set|
@@ -49,7 +49,7 @@ class Gem::S3URISigner
string_to_sign = generate_string_to_sign(date_time, credential_info, canonical_request)
signature = generate_signature(s3_config, date, string_to_sign)
- URI.parse("https://#{canonical_host}#{uri.path}?#{query_params}&X-Amz-Signature=#{signature}")
end
private
@@ -152,7 +152,7 @@ class Gem::S3URISigner
end
def ec2_metadata_request(url)
- uri = URI(url)
@request_pool ||= create_request_pool(uri)
request = Gem::Request.new(uri, Gem::Net::HTTP::Get, nil, @request_pool)
response = request.fetch
@@ -221,14 +221,14 @@ class Gem::Source::Git < Gem::Source
end
##
- # A hash for the git gem based on the git repository URI.
def uri_hash # :nodoc:
require_relative "../openssl"
normalized =
if @repository.match?(%r{^\w+://(\w+@)?})
- uri = URI(@repository).normalize.to_s.sub %r{/$},""
uri.sub(/\A(\w+)/) { $1.downcase }
else
@repository
@@ -44,7 +44,7 @@ class Gem::SourceList
end
##
- # Appends +obj+ to the source list which may be a Gem::Source, URI or URI
# String.
def <<(obj)
@@ -427,13 +427,13 @@ or set it to nil if you don't want to specify a license.
# Make sure a homepage is valid HTTP/HTTPS URI
if homepage && !homepage.empty?
- require "uri"
begin
- homepage_uri = URI.parse(homepage)
- unless [URI::HTTP, URI::HTTPS].member? homepage_uri.class
error "\"#{homepage}\" is not a valid HTTP URI"
end
- rescue URI::InvalidURIError
error "\"#{homepage}\" is not a valid HTTP URI"
end
end
@@ -16,9 +16,9 @@ class Gem::Uri
# Parses uri, raising if it's invalid
def self.parse!(uri)
- require "uri"
- raise URI::InvalidURIError unless uri
return uri unless uri.is_a?(String)
@@ -28,9 +28,9 @@ class Gem::Uri
# as "%7BDESede%7D". If this is escaped again the percentage
# symbols will be escaped.
begin
- URI.parse(uri)
- rescue URI::InvalidURIError
- URI.parse(URI::DEFAULT_PARSER.escape(uri))
end
end
@@ -39,7 +39,7 @@ class Gem::Uri
def self.parse(uri)
parse!(uri)
- rescue URI::InvalidURIError
uri
end
@@ -105,7 +105,7 @@ module Gem::Util
end
##
- # Corrects +path+ (usually returned by `URI.parse().path` on Windows), that
# comes with a leading slash.
def self.correct_for_windows_path(path)
@@ -0,0 +1 @@
@@ -0,0 +1,22 @@
@@ -0,0 +1,104 @@
@@ -0,0 +1,853 @@
@@ -0,0 +1,100 @@
@@ -0,0 +1,267 @@
@@ -0,0 +1,1588 @@
@@ -0,0 +1,125 @@
@@ -0,0 +1,23 @@
@@ -0,0 +1,261 @@
@@ -0,0 +1,22 @@
@@ -0,0 +1,293 @@
@@ -0,0 +1,539 @@
@@ -0,0 +1,183 @@
@@ -0,0 +1,6 @@
@@ -0,0 +1,83 @@
@@ -0,0 +1,23 @@