[rubygems/rubygems] Update vendored uri to 1.0.3

https://github.com/rubygems/rubygems/commit/176dc7421c
This commit is contained in:
Hiroshi SHIBATA 2025-02-27 18:18:25 +09:00
parent f52a2e4b12
commit e4c5531b4c
Notes: git 2025-03-03 06:52:55 +00:00
10 changed files with 59 additions and 49 deletions

View File

@ -13,15 +13,19 @@ require_relative "rfc2396_parser"
require_relative "rfc3986_parser" require_relative "rfc3986_parser"
module Bundler::URI module Bundler::URI
# The default parser instance for RFC 2396.
RFC2396_PARSER = RFC2396_Parser.new RFC2396_PARSER = RFC2396_Parser.new
Ractor.make_shareable(RFC2396_PARSER) if defined?(Ractor) Ractor.make_shareable(RFC2396_PARSER) if defined?(Ractor)
# The default parser instance for RFC 3986.
RFC3986_PARSER = RFC3986_Parser.new RFC3986_PARSER = RFC3986_Parser.new
Ractor.make_shareable(RFC3986_PARSER) if defined?(Ractor) Ractor.make_shareable(RFC3986_PARSER) if defined?(Ractor)
# The default parser instance.
DEFAULT_PARSER = RFC3986_PARSER DEFAULT_PARSER = RFC3986_PARSER
Ractor.make_shareable(DEFAULT_PARSER) if defined?(Ractor) Ractor.make_shareable(DEFAULT_PARSER) if defined?(Ractor)
# Set the default parser instance.
def self.parser=(parser = RFC3986_PARSER) def self.parser=(parser = RFC3986_PARSER)
remove_const(:Parser) if defined?(::Bundler::URI::Parser) remove_const(:Parser) if defined?(::Bundler::URI::Parser)
const_set("Parser", parser.class) const_set("Parser", parser.class)
@ -40,7 +44,7 @@ module Bundler::URI
end end
self.parser = RFC3986_PARSER self.parser = RFC3986_PARSER
def self.const_missing(const) def self.const_missing(const) # :nodoc:
if const == :REGEXP if const == :REGEXP
warn "Bundler::URI::REGEXP is obsolete. Use Bundler::URI::RFC2396_REGEXP explicitly.", uplevel: 1 if $VERBOSE warn "Bundler::URI::REGEXP is obsolete. Use Bundler::URI::RFC2396_REGEXP explicitly.", uplevel: 1 if $VERBOSE
Bundler::URI::RFC2396_REGEXP Bundler::URI::RFC2396_REGEXP
@ -87,7 +91,7 @@ module Bundler::URI
module_function :make_components_hash module_function :make_components_hash
end end
module Schemes module Schemes # :nodoc:
end end
private_constant :Schemes private_constant :Schemes
@ -305,7 +309,7 @@ module Bundler::URI
256.times do |i| 256.times do |i|
TBLENCWWWCOMP_[-i.chr] = -('%%%02X' % i) TBLENCWWWCOMP_[-i.chr] = -('%%%02X' % i)
end end
TBLENCURICOMP_ = TBLENCWWWCOMP_.dup.freeze TBLENCURICOMP_ = TBLENCWWWCOMP_.dup.freeze # :nodoc:
TBLENCWWWCOMP_[' '] = '+' TBLENCWWWCOMP_[' '] = '+'
TBLENCWWWCOMP_.freeze TBLENCWWWCOMP_.freeze
TBLDECWWWCOMP_ = {} # :nodoc: TBLDECWWWCOMP_ = {} # :nodoc:

View File

@ -737,12 +737,12 @@ module Bundler::URI
end end
private :check_registry private :check_registry
def set_registry(v) #:nodoc: def set_registry(v) # :nodoc:
raise InvalidURIError, "cannot set registry" raise InvalidURIError, "cannot set registry"
end end
protected :set_registry protected :set_registry
def registry=(v) def registry=(v) # :nodoc:
raise InvalidURIError, "cannot set registry" raise InvalidURIError, "cannot set registry"
end end
@ -1133,17 +1133,16 @@ module Bundler::URI
base.fragment=(nil) base.fragment=(nil)
# RFC2396, Section 5.2, 4) # RFC2396, Section 5.2, 4)
if !authority if authority
base.set_path(merge_path(base.path, rel.path)) if base.path && rel.path base.set_userinfo(rel.userinfo)
else base.set_host(rel.host)
# RFC2396, Section 5.2, 4) base.set_port(rel.port || base.default_port)
base.set_path(rel.path) if rel.path base.set_path(rel.path)
elsif base.path && rel.path
base.set_path(merge_path(base.path, rel.path))
end end
# RFC2396, Section 5.2, 7) # RFC2396, Section 5.2, 7)
base.set_userinfo(rel.userinfo) if rel.userinfo
base.set_host(rel.host) if rel.host
base.set_port(rel.port) if rel.port
base.query = rel.query if rel.query base.query = rel.query if rel.query
base.fragment=(rel.fragment) if rel.fragment base.fragment=(rel.fragment) if rel.fragment
@ -1392,10 +1391,12 @@ module Bundler::URI
end end
end end
# Returns the hash value.
def hash def hash
self.component_ary.hash self.component_ary.hash
end end
# Compares with _oth_ for Hash.
def eql?(oth) def eql?(oth)
self.class == oth.class && self.class == oth.class &&
parser == oth.parser && parser == oth.parser &&
@ -1438,7 +1439,7 @@ module Bundler::URI
end end
end end
def inspect def inspect # :nodoc:
"#<#{self.class} #{self}>" "#<#{self.class} #{self}>"
end end

View File

@ -321,14 +321,14 @@ module Bundler::URI
str.gsub(escaped) { [$&[1, 2]].pack('H2').force_encoding(enc) } str.gsub(escaped) { [$&[1, 2]].pack('H2').force_encoding(enc) }
end end
@@to_s = Kernel.instance_method(:to_s) TO_S = Kernel.instance_method(:to_s) # :nodoc:
if @@to_s.respond_to?(:bind_call) if TO_S.respond_to?(:bind_call)
def inspect def inspect # :nodoc:
@@to_s.bind_call(self) TO_S.bind_call(self)
end end
else else
def inspect def inspect # :nodoc:
@@to_s.bind(self).call TO_S.bind(self).call
end end
end end

View File

@ -1,6 +1,6 @@
module Bundler::URI module Bundler::URI
# :stopdoc: # :stopdoc:
VERSION_CODE = '010002'.freeze VERSION_CODE = '010003'.freeze
VERSION = VERSION_CODE.scan(/../).collect{|n| n.to_i}.join('.').freeze VERSION = VERSION_CODE.scan(/../).collect{|n| n.to_i}.join('.').freeze
# :startdoc: # :startdoc:
end end

View File

@ -13,15 +13,19 @@ require_relative "rfc2396_parser"
require_relative "rfc3986_parser" require_relative "rfc3986_parser"
module Gem::URI module Gem::URI
# The default parser instance for RFC 2396.
RFC2396_PARSER = RFC2396_Parser.new RFC2396_PARSER = RFC2396_Parser.new
Ractor.make_shareable(RFC2396_PARSER) if defined?(Ractor) Ractor.make_shareable(RFC2396_PARSER) if defined?(Ractor)
# The default parser instance for RFC 3986.
RFC3986_PARSER = RFC3986_Parser.new RFC3986_PARSER = RFC3986_Parser.new
Ractor.make_shareable(RFC3986_PARSER) if defined?(Ractor) Ractor.make_shareable(RFC3986_PARSER) if defined?(Ractor)
# The default parser instance.
DEFAULT_PARSER = RFC3986_PARSER DEFAULT_PARSER = RFC3986_PARSER
Ractor.make_shareable(DEFAULT_PARSER) if defined?(Ractor) Ractor.make_shareable(DEFAULT_PARSER) if defined?(Ractor)
# Set the default parser instance.
def self.parser=(parser = RFC3986_PARSER) def self.parser=(parser = RFC3986_PARSER)
remove_const(:Parser) if defined?(::Gem::URI::Parser) remove_const(:Parser) if defined?(::Gem::URI::Parser)
const_set("Parser", parser.class) const_set("Parser", parser.class)
@ -40,7 +44,7 @@ module Gem::URI
end end
self.parser = RFC3986_PARSER self.parser = RFC3986_PARSER
def self.const_missing(const) def self.const_missing(const) # :nodoc:
if const == :REGEXP if const == :REGEXP
warn "Gem::URI::REGEXP is obsolete. Use Gem::URI::RFC2396_REGEXP explicitly.", uplevel: 1 if $VERBOSE warn "Gem::URI::REGEXP is obsolete. Use Gem::URI::RFC2396_REGEXP explicitly.", uplevel: 1 if $VERBOSE
Gem::URI::RFC2396_REGEXP Gem::URI::RFC2396_REGEXP
@ -87,7 +91,7 @@ module Gem::URI
module_function :make_components_hash module_function :make_components_hash
end end
module Schemes module Schemes # :nodoc:
end end
private_constant :Schemes private_constant :Schemes
@ -305,7 +309,7 @@ module Gem::URI
256.times do |i| 256.times do |i|
TBLENCWWWCOMP_[-i.chr] = -('%%%02X' % i) TBLENCWWWCOMP_[-i.chr] = -('%%%02X' % i)
end end
TBLENCURICOMP_ = TBLENCWWWCOMP_.dup.freeze TBLENCURICOMP_ = TBLENCWWWCOMP_.dup.freeze # :nodoc:
TBLENCWWWCOMP_[' '] = '+' TBLENCWWWCOMP_[' '] = '+'
TBLENCWWWCOMP_.freeze TBLENCWWWCOMP_.freeze
TBLDECWWWCOMP_ = {} # :nodoc: TBLDECWWWCOMP_ = {} # :nodoc:
@ -424,7 +428,7 @@ module Gem::URI
private_class_method :_decode_uri_component private_class_method :_decode_uri_component
# Returns a URL-encoded string derived from the given # Returns a URL-encoded string derived from the given
# {Enumerable}[https://docs.ruby-lang.org/en/master/Enumerable.html#module-Enumerable-label-Enumerable+in+Ruby+Classes] # {Enumerable}[rdoc-ref:Enumerable@Enumerable+in+Ruby+Classes]
# +enum+. # +enum+.
# #
# The result is suitable for use as form data # The result is suitable for use as form data
@ -493,7 +497,7 @@ module Gem::URI
# each +key+/+value+ pair is converted to one or more fields: # each +key+/+value+ pair is converted to one or more fields:
# #
# - If +value+ is # - If +value+ is
# {Array-convertible}[https://docs.ruby-lang.org/en/master/implicit_conversion_rdoc.html#label-Array-Convertible+Objects], # {Array-convertible}[rdoc-ref:implicit_conversion.rdoc@Array-Convertible+Objects],
# each element +ele+ in +value+ is paired with +key+ to form a field: # each element +ele+ in +value+ is paired with +key+ to form a field:
# #
# name = Gem::URI.encode_www_form_component(key, enc) # name = Gem::URI.encode_www_form_component(key, enc)
@ -551,7 +555,7 @@ module Gem::URI
# each subarray is a name/value pair (both are strings). # each subarray is a name/value pair (both are strings).
# Each returned string has encoding +enc+, # Each returned string has encoding +enc+,
# and has had invalid characters removed via # and has had invalid characters removed via
# {String#scrub}[https://docs.ruby-lang.org/en/master/String.html#method-i-scrub]. # {String#scrub}[rdoc-ref:String#scrub].
# #
# A simple example: # A simple example:
# #

View File

@ -737,12 +737,12 @@ module Gem::URI
end end
private :check_registry private :check_registry
def set_registry(v) #:nodoc: def set_registry(v) # :nodoc:
raise InvalidURIError, "cannot set registry" raise InvalidURIError, "cannot set registry"
end end
protected :set_registry protected :set_registry
def registry=(v) def registry=(v) # :nodoc:
raise InvalidURIError, "cannot set registry" raise InvalidURIError, "cannot set registry"
end end
@ -1133,17 +1133,16 @@ module Gem::URI
base.fragment=(nil) base.fragment=(nil)
# RFC2396, Section 5.2, 4) # RFC2396, Section 5.2, 4)
if !authority if authority
base.set_path(merge_path(base.path, rel.path)) if base.path && rel.path base.set_userinfo(rel.userinfo)
else base.set_host(rel.host)
# RFC2396, Section 5.2, 4) base.set_port(rel.port || base.default_port)
base.set_path(rel.path) if rel.path base.set_path(rel.path)
elsif base.path && rel.path
base.set_path(merge_path(base.path, rel.path))
end end
# RFC2396, Section 5.2, 7) # RFC2396, Section 5.2, 7)
base.set_userinfo(rel.userinfo) if rel.userinfo
base.set_host(rel.host) if rel.host
base.set_port(rel.port) if rel.port
base.query = rel.query if rel.query base.query = rel.query if rel.query
base.fragment=(rel.fragment) if rel.fragment base.fragment=(rel.fragment) if rel.fragment
@ -1392,10 +1391,12 @@ module Gem::URI
end end
end end
# Returns the hash value.
def hash def hash
self.component_ary.hash self.component_ary.hash
end end
# Compares with _oth_ for Hash.
def eql?(oth) def eql?(oth)
self.class == oth.class && self.class == oth.class &&
parser == oth.parser && parser == oth.parser &&
@ -1438,7 +1439,7 @@ module Gem::URI
end end
end end
def inspect def inspect # :nodoc:
"#<#{self.class} #{self}>" "#<#{self.class} #{self}>"
end end

View File

@ -321,14 +321,14 @@ module Gem::URI
str.gsub(escaped) { [$&[1, 2]].pack('H2').force_encoding(enc) } str.gsub(escaped) { [$&[1, 2]].pack('H2').force_encoding(enc) }
end end
@@to_s = Kernel.instance_method(:to_s) TO_S = Kernel.instance_method(:to_s) # :nodoc:
if @@to_s.respond_to?(:bind_call) if TO_S.respond_to?(:bind_call)
def inspect def inspect # :nodoc:
@@to_s.bind_call(self) TO_S.bind_call(self)
end end
else else
def inspect def inspect # :nodoc:
@@to_s.bind(self).call TO_S.bind(self).call
end end
end end

View File

@ -1,6 +1,6 @@
module Gem::URI module Gem::URI
# :stopdoc: # :stopdoc:
VERSION_CODE = '010002'.freeze VERSION_CODE = '010003'.freeze
VERSION = VERSION_CODE.scan(/../).collect{|n| n.to_i}.join('.').freeze VERSION = VERSION_CODE.scan(/../).collect{|n| n.to_i}.join('.').freeze
# :startdoc: # :startdoc:
end end

View File

@ -14,4 +14,4 @@ gem "securerandom", "0.4.1"
gem "timeout", "0.4.3" gem "timeout", "0.4.3"
gem "thor", "1.3.2" gem "thor", "1.3.2"
gem "tsort", "0.2.0" gem "tsort", "0.2.0"
gem "uri", "1.0.2" gem "uri", "1.0.3"

View File

@ -27,7 +27,7 @@ GEM
thor (1.3.2) thor (1.3.2)
timeout (0.4.3) timeout (0.4.3)
tsort (0.2.0) tsort (0.2.0)
uri (1.0.2) uri (1.0.3)
PLATFORMS PLATFORMS
java java
@ -50,7 +50,7 @@ DEPENDENCIES
thor (= 1.3.2) thor (= 1.3.2)
timeout (= 0.4.3) timeout (= 0.4.3)
tsort (= 0.2.0) tsort (= 0.2.0)
uri (= 1.0.2) uri (= 1.0.3)
CHECKSUMS CHECKSUMS
connection_pool (2.4.1) sha256=0f40cf997091f1f04ff66da67eabd61a9fe0d4928b9a3645228532512fab62f4 connection_pool (2.4.1) sha256=0f40cf997091f1f04ff66da67eabd61a9fe0d4928b9a3645228532512fab62f4
@ -66,7 +66,7 @@ CHECKSUMS
thor (1.3.2) sha256=eef0293b9e24158ccad7ab383ae83534b7ad4ed99c09f96f1a6b036550abbeda thor (1.3.2) sha256=eef0293b9e24158ccad7ab383ae83534b7ad4ed99c09f96f1a6b036550abbeda
timeout (0.4.3) sha256=9509f079b2b55fe4236d79633bd75e34c1c1e7e3fb4b56cb5fda61f80a0fe30e timeout (0.4.3) sha256=9509f079b2b55fe4236d79633bd75e34c1c1e7e3fb4b56cb5fda61f80a0fe30e
tsort (0.2.0) sha256=9650a793f6859a43b6641671278f79cfead60ac714148aabe4e3f0060480089f tsort (0.2.0) sha256=9650a793f6859a43b6641671278f79cfead60ac714148aabe4e3f0060480089f
uri (1.0.2) sha256=b303504ceb7e5905771fa7fa14b649652fa949df18b5880d69cfb12494791e27 uri (1.0.3) sha256=e9f2244608eea2f7bc357d954c65c910ce0399ca5e18a7a29207ac22d8767011
BUNDLED WITH BUNDLED WITH
2.7.0.dev 2.7.0.dev