diff --git a/lib/bundler/vendor/uri/lib/uri.rb b/lib/bundler/vendor/uri/lib/uri.rb index 976320f6bd..57b380c480 100644 --- a/lib/bundler/vendor/uri/lib/uri.rb +++ b/lib/bundler/vendor/uri/lib/uri.rb @@ -1,6 +1,6 @@ # frozen_string_literal: false # Bundler::URI is a module providing classes to handle Uniform Resource Identifiers -# (RFC2396[http://tools.ietf.org/html/rfc2396]). +# (RFC2396[https://www.rfc-editor.org/rfc/rfc2396]). # # == Features # @@ -47,14 +47,14 @@ # A good place to view an RFC spec is http://www.ietf.org/rfc.html. # # Here is a list of all related RFC's: -# - RFC822[http://tools.ietf.org/html/rfc822] -# - RFC1738[http://tools.ietf.org/html/rfc1738] -# - RFC2255[http://tools.ietf.org/html/rfc2255] -# - RFC2368[http://tools.ietf.org/html/rfc2368] -# - RFC2373[http://tools.ietf.org/html/rfc2373] -# - RFC2396[http://tools.ietf.org/html/rfc2396] -# - RFC2732[http://tools.ietf.org/html/rfc2732] -# - RFC3986[http://tools.ietf.org/html/rfc3986] +# - RFC822[https://www.rfc-editor.org/rfc/rfc822] +# - RFC1738[https://www.rfc-editor.org/rfc/rfc1738] +# - RFC2255[https://www.rfc-editor.org/rfc/rfc2255] +# - RFC2368[https://www.rfc-editor.org/rfc/rfc2368] +# - RFC2373[https://www.rfc-editor.org/rfc/rfc2373] +# - RFC2396[https://www.rfc-editor.org/rfc/rfc2396] +# - RFC2732[https://www.rfc-editor.org/rfc/rfc2732] +# - RFC3986[https://www.rfc-editor.org/rfc/rfc3986] # # == Class tree # diff --git a/lib/bundler/vendor/uri/lib/uri/common.rb b/lib/bundler/vendor/uri/lib/uri/common.rb index 89044da036..c7236fce98 100644 --- a/lib/bundler/vendor/uri/lib/uri/common.rb +++ b/lib/bundler/vendor/uri/lib/uri/common.rb @@ -13,26 +13,52 @@ require_relative "rfc2396_parser" require_relative "rfc3986_parser" module Bundler::URI - include RFC2396_REGEXP - - REGEXP = RFC2396_REGEXP - Parser = RFC2396_Parser - RFC3986_PARSER = RFC3986_Parser.new - Ractor.make_shareable(RFC3986_PARSER) if defined?(Ractor) RFC2396_PARSER = RFC2396_Parser.new Ractor.make_shareable(RFC2396_PARSER) if defined?(Ractor) - # Bundler::URI::Parser.new - DEFAULT_PARSER = Parser.new - DEFAULT_PARSER.pattern.each_pair do |sym, str| - unless REGEXP::PATTERN.const_defined?(sym) - REGEXP::PATTERN.const_set(sym, str) + RFC3986_PARSER = RFC3986_Parser.new + Ractor.make_shareable(RFC3986_PARSER) if defined?(Ractor) + + DEFAULT_PARSER = RFC3986_PARSER + Ractor.make_shareable(DEFAULT_PARSER) if defined?(Ractor) + + def self.parser=(parser = RFC3986_PARSER) + remove_const(:Parser) if defined?(::Bundler::URI::Parser) + const_set("Parser", parser.class) + + remove_const(:REGEXP) if defined?(::Bundler::URI::REGEXP) + remove_const(:PATTERN) if defined?(::Bundler::URI::PATTERN) + if Parser == RFC2396_Parser + const_set("REGEXP", Bundler::URI::RFC2396_REGEXP) + const_set("PATTERN", Bundler::URI::RFC2396_REGEXP::PATTERN) + Parser.new.pattern.each_pair do |sym, str| + unless REGEXP::PATTERN.const_defined?(sym) + REGEXP::PATTERN.const_set(sym, str) + end + end + end + + Parser.new.regexp.each_pair do |sym, str| + remove_const(sym) if const_defined?(sym) + const_set(sym, str) end end - DEFAULT_PARSER.regexp.each_pair do |sym, str| - const_set(sym, str) + self.parser = RFC3986_PARSER + + def self.const_missing(const) + if const == :REGEXP + warn "Bundler::URI::REGEXP is obsolete. Use Bundler::URI::RFC2396_REGEXP explicitly.", uplevel: 1 if $VERBOSE + Bundler::URI::RFC2396_REGEXP + elsif value = RFC2396_PARSER.regexp[const] + warn "Bundler::URI::#{const} is obsolete. Use RFC2396_PARSER.regexp[#{const.inspect}] explicitly.", uplevel: 1 if $VERBOSE + value + elsif value = RFC2396_Parser.const_get(const) + warn "Bundler::URI::#{const} is obsolete. Use RFC2396_Parser::#{const} explicitly.", uplevel: 1 if $VERBOSE + value + else + super + end end - Ractor.make_shareable(DEFAULT_PARSER) if defined?(Ractor) module Util # :nodoc: def make_components_hash(klass, array_hash) @@ -170,7 +196,7 @@ module Bundler::URI # ["fragment", "top"]] # def self.split(uri) - RFC3986_PARSER.split(uri) + DEFAULT_PARSER.split(uri) end # Returns a new \Bundler::URI object constructed from the given string +uri+: @@ -184,7 +210,7 @@ module Bundler::URI # if it may contain invalid Bundler::URI characters. # def self.parse(uri) - RFC3986_PARSER.parse(uri) + DEFAULT_PARSER.parse(uri) end # Merges the given Bundler::URI strings +str+ @@ -211,7 +237,7 @@ module Bundler::URI # # => # # def self.join(*str) - RFC3986_PARSER.join(*str) + DEFAULT_PARSER.join(*str) end # diff --git a/lib/bundler/vendor/uri/lib/uri/file.rb b/lib/bundler/vendor/uri/lib/uri/file.rb index 8d75a9de7a..de347af6eb 100644 --- a/lib/bundler/vendor/uri/lib/uri/file.rb +++ b/lib/bundler/vendor/uri/lib/uri/file.rb @@ -70,17 +70,17 @@ module Bundler::URI # raise InvalidURIError def check_userinfo(user) - raise Bundler::URI::InvalidURIError, "can not set userinfo for file Bundler::URI" + raise Bundler::URI::InvalidURIError, "cannot set userinfo for file Bundler::URI" end # raise InvalidURIError def check_user(user) - raise Bundler::URI::InvalidURIError, "can not set user for file Bundler::URI" + raise Bundler::URI::InvalidURIError, "cannot set user for file Bundler::URI" end # raise InvalidURIError def check_password(user) - raise Bundler::URI::InvalidURIError, "can not set password for file Bundler::URI" + raise Bundler::URI::InvalidURIError, "cannot set password for file Bundler::URI" end # do nothing diff --git a/lib/bundler/vendor/uri/lib/uri/ftp.rb b/lib/bundler/vendor/uri/lib/uri/ftp.rb index 48b4c6718d..f83985fd3d 100644 --- a/lib/bundler/vendor/uri/lib/uri/ftp.rb +++ b/lib/bundler/vendor/uri/lib/uri/ftp.rb @@ -17,7 +17,7 @@ module Bundler::URI # This class will be redesigned because of difference of implementations; # the structure of its path. draft-hoffman-ftp-uri-04 is a draft but it # is a good summary about the de facto spec. - # http://tools.ietf.org/html/draft-hoffman-ftp-uri-04 + # https://datatracker.ietf.org/doc/html/draft-hoffman-ftp-uri-04 # class FTP < Generic # A Default port of 21 for Bundler::URI::FTP. diff --git a/lib/bundler/vendor/uri/lib/uri/generic.rb b/lib/bundler/vendor/uri/lib/uri/generic.rb index 762c425ac1..8b097fba99 100644 --- a/lib/bundler/vendor/uri/lib/uri/generic.rb +++ b/lib/bundler/vendor/uri/lib/uri/generic.rb @@ -82,7 +82,7 @@ module Bundler::URI if args.kind_of?(Array) return self.build(args.collect{|x| if x.is_a?(String) - DEFAULT_PARSER.escape(x) + Bundler::URI::RFC2396_PARSER.escape(x) else x end @@ -91,7 +91,7 @@ module Bundler::URI tmp = {} args.each do |key, value| tmp[key] = if value - DEFAULT_PARSER.escape(value) + Bundler::URI::RFC2396_PARSER.escape(value) else value end @@ -393,7 +393,7 @@ module Bundler::URI def check_user(v) if @opaque raise InvalidURIError, - "can not set user with opaque" + "cannot set user with opaque" end return v unless v @@ -417,7 +417,7 @@ module Bundler::URI def check_password(v, user = @user) if @opaque raise InvalidURIError, - "can not set password with opaque" + "cannot set password with opaque" end return v unless v @@ -596,7 +596,7 @@ module Bundler::URI if @opaque raise InvalidURIError, - "can not set host with registry or opaque" + "cannot set host with registry or opaque" elsif parser.regexp[:HOST] !~ v raise InvalidComponentError, "bad component(expected host component): #{v}" @@ -685,7 +685,7 @@ module Bundler::URI if @opaque raise InvalidURIError, - "can not set port with registry or opaque" + "cannot set port with registry or opaque" elsif !v.kind_of?(Integer) && parser.regexp[:PORT] !~ v raise InvalidComponentError, "bad component(expected port component): #{v.inspect}" @@ -733,17 +733,17 @@ module Bundler::URI end def check_registry(v) # :nodoc: - raise InvalidURIError, "can not set registry" + raise InvalidURIError, "cannot set registry" end private :check_registry def set_registry(v) #:nodoc: - raise InvalidURIError, "can not set registry" + raise InvalidURIError, "cannot set registry" end protected :set_registry def registry=(v) - raise InvalidURIError, "can not set registry" + raise InvalidURIError, "cannot set registry" end # @@ -866,7 +866,7 @@ module Bundler::URI # hier_part = ( net_path | abs_path ) [ "?" query ] if @host || @port || @user || @path # userinfo = @user + ':' + @password raise InvalidURIError, - "can not set opaque with host, port, userinfo or path" + "cannot set opaque with host, port, userinfo or path" elsif v && parser.regexp[:OPAQUE] !~ v raise InvalidComponentError, "bad component(expected opaque component): #{v}" @@ -945,7 +945,7 @@ module Bundler::URI # == Description # # Bundler::URI has components listed in order of decreasing significance from left to right, - # see RFC3986 https://tools.ietf.org/html/rfc3986 1.2.3. + # see RFC3986 https://www.rfc-editor.org/rfc/rfc3986 1.2.3. # # == Usage # @@ -1235,7 +1235,7 @@ module Bundler::URI return rel, rel end - # you can modify `rel', but can not `oth'. + # you can modify `rel', but cannot `oth'. return oth, rel end private :route_from0 @@ -1260,7 +1260,7 @@ module Bundler::URI # #=> # # def route_from(oth) - # you can modify `rel', but can not `oth'. + # you can modify `rel', but cannot `oth'. begin oth, rel = route_from0(oth) rescue @@ -1364,6 +1364,9 @@ module Bundler::URI str << ':' str << @port.to_s end + if (@host || @port) && !@path.empty? && !@path.start_with?('/') + str << '/' + end str << @path if @query str << '?' @@ -1399,19 +1402,6 @@ module Bundler::URI self.component_ary.eql?(oth.component_ary) end -=begin - ---- Bundler::URI::Generic#===(oth) - -=end -# def ===(oth) -# raise NotImplementedError -# end - -=begin -=end - - # Returns an Array of the components defined from the COMPONENT Array. def component_ary component.collect do |x| diff --git a/lib/bundler/vendor/uri/lib/uri/http.rb b/lib/bundler/vendor/uri/lib/uri/http.rb index 2c44810644..6c34a469b7 100644 --- a/lib/bundler/vendor/uri/lib/uri/http.rb +++ b/lib/bundler/vendor/uri/lib/uri/http.rb @@ -85,7 +85,7 @@ module Bundler::URI # == Description # # Returns the authority for an HTTP uri, as defined in - # https://datatracker.ietf.org/doc/html/rfc3986/#section-3.2. + # https://www.rfc-editor.org/rfc/rfc3986#section-3.2. # # # Example: @@ -106,7 +106,7 @@ module Bundler::URI # == Description # # Returns the origin for an HTTP uri, as defined in - # https://datatracker.ietf.org/doc/html/rfc6454. + # https://www.rfc-editor.org/rfc/rfc6454. # # # Example: diff --git a/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb b/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb index 09c22c9906..0b7897d92a 100644 --- a/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +++ b/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb @@ -140,11 +140,11 @@ module Bundler::URI if !scheme raise InvalidURIError, - "bad Bundler::URI(absolute but no scheme): #{uri}" + "bad Bundler::URI (absolute but no scheme): #{uri}" end if !opaque && (!path && (!host && !registry)) raise InvalidURIError, - "bad Bundler::URI(absolute but no path): #{uri}" + "bad Bundler::URI (absolute but no path): #{uri}" end when @regexp[:REL_URI] @@ -173,7 +173,7 @@ module Bundler::URI # server = [ [ userinfo "@" ] hostport ] else - raise InvalidURIError, "bad Bundler::URI(is not Bundler::URI?): #{uri}" + raise InvalidURIError, "bad Bundler::URI (is not Bundler::URI?): #{uri}" end path = '' if !path && !opaque # (see RFC2396 Section 5.2) diff --git a/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb b/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb index 4c9882f595..7473adcb68 100644 --- a/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +++ b/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb @@ -78,7 +78,7 @@ module Bundler::URI begin uri = uri.to_str rescue NoMethodError - raise InvalidURIError, "bad Bundler::URI(is not Bundler::URI?): #{uri.inspect}" + raise InvalidURIError, "bad Bundler::URI (is not Bundler::URI?): #{uri.inspect}" end uri.ascii_only? or raise InvalidURIError, "Bundler::URI must be ascii only #{uri.dump}" @@ -127,7 +127,7 @@ module Bundler::URI m["fragment"] ] else - raise InvalidURIError, "bad Bundler::URI(is not Bundler::URI?): #{uri.inspect}" + raise InvalidURIError, "bad Bundler::URI (is not Bundler::URI?): #{uri.inspect}" end end @@ -135,12 +135,35 @@ module Bundler::URI Bundler::URI.for(*self.split(uri), self) end - def join(*uris) # :nodoc: uris[0] = convert_to_uri(uris[0]) uris.inject :merge end + # Compatibility for RFC2396 parser + def extract(str, schemes = nil, &block) # :nodoc: + warn "Bundler::URI::RFC3986_PARSER.extract is obsoleted. Use Bundler::URI::RFC2396_PARSER.extract explicitly.", uplevel: 1 if $VERBOSE + RFC2396_PARSER.extract(str, schemes, &block) + end + + # Compatibility for RFC2396 parser + def make_regexp(schemes = nil) # :nodoc: + warn "Bundler::URI::RFC3986_PARSER.make_regexp is obsoleted. Use Bundler::URI::RFC2396_PARSER.make_regexp explicitly.", uplevel: 1 if $VERBOSE + RFC2396_PARSER.make_regexp(schemes) + end + + # Compatibility for RFC2396 parser + def escape(str, unsafe = nil) # :nodoc: + warn "Bundler::URI::RFC3986_PARSER.escape is obsoleted. Use Bundler::URI::RFC2396_PARSER.escape explicitly.", uplevel: 1 if $VERBOSE + unsafe ? RFC2396_PARSER.escape(str, unsafe) : RFC2396_PARSER.escape(str) + end + + # Compatibility for RFC2396 parser + def unescape(str, escaped = nil) # :nodoc: + warn "Bundler::URI::RFC3986_PARSER.unescape is obsoleted. Use Bundler::URI::RFC2396_PARSER.unescape explicitly.", uplevel: 1 if $VERBOSE + escaped ? RFC2396_PARSER.unescape(str, escaped) : RFC2396_PARSER.unescape(str) + end + @@to_s = Kernel.instance_method(:to_s) if @@to_s.respond_to?(:bind_call) def inspect diff --git a/lib/bundler/vendor/uri/lib/uri/version.rb b/lib/bundler/vendor/uri/lib/uri/version.rb index ac94e15221..ce236bdb30 100644 --- a/lib/bundler/vendor/uri/lib/uri/version.rb +++ b/lib/bundler/vendor/uri/lib/uri/version.rb @@ -1,6 +1,6 @@ module Bundler::URI # :stopdoc: - VERSION_CODE = '001301'.freeze + VERSION_CODE = '010001'.freeze VERSION = VERSION_CODE.scan(/../).collect{|n| n.to_i}.join('.').freeze # :startdoc: end diff --git a/lib/rubygems/vendor/uri/lib/uri.rb b/lib/rubygems/vendor/uri/lib/uri.rb index f1ccc167cc..4691b122b2 100644 --- a/lib/rubygems/vendor/uri/lib/uri.rb +++ b/lib/rubygems/vendor/uri/lib/uri.rb @@ -1,6 +1,6 @@ # frozen_string_literal: false # Gem::URI is a module providing classes to handle Uniform Resource Identifiers -# (RFC2396[http://tools.ietf.org/html/rfc2396]). +# (RFC2396[https://www.rfc-editor.org/rfc/rfc2396]). # # == Features # @@ -47,14 +47,14 @@ # A good place to view an RFC spec is http://www.ietf.org/rfc.html. # # Here is a list of all related RFC's: -# - RFC822[http://tools.ietf.org/html/rfc822] -# - RFC1738[http://tools.ietf.org/html/rfc1738] -# - RFC2255[http://tools.ietf.org/html/rfc2255] -# - RFC2368[http://tools.ietf.org/html/rfc2368] -# - RFC2373[http://tools.ietf.org/html/rfc2373] -# - RFC2396[http://tools.ietf.org/html/rfc2396] -# - RFC2732[http://tools.ietf.org/html/rfc2732] -# - RFC3986[http://tools.ietf.org/html/rfc3986] +# - RFC822[https://www.rfc-editor.org/rfc/rfc822] +# - RFC1738[https://www.rfc-editor.org/rfc/rfc1738] +# - RFC2255[https://www.rfc-editor.org/rfc/rfc2255] +# - RFC2368[https://www.rfc-editor.org/rfc/rfc2368] +# - RFC2373[https://www.rfc-editor.org/rfc/rfc2373] +# - RFC2396[https://www.rfc-editor.org/rfc/rfc2396] +# - RFC2732[https://www.rfc-editor.org/rfc/rfc2732] +# - RFC3986[https://www.rfc-editor.org/rfc/rfc3986] # # == Class tree # diff --git a/lib/rubygems/vendor/uri/lib/uri/common.rb b/lib/rubygems/vendor/uri/lib/uri/common.rb index da2651084c..37c5c80270 100644 --- a/lib/rubygems/vendor/uri/lib/uri/common.rb +++ b/lib/rubygems/vendor/uri/lib/uri/common.rb @@ -13,26 +13,52 @@ require_relative "rfc2396_parser" require_relative "rfc3986_parser" module Gem::URI - include RFC2396_REGEXP - - REGEXP = RFC2396_REGEXP - Parser = RFC2396_Parser - RFC3986_PARSER = RFC3986_Parser.new - Ractor.make_shareable(RFC3986_PARSER) if defined?(Ractor) RFC2396_PARSER = RFC2396_Parser.new Ractor.make_shareable(RFC2396_PARSER) if defined?(Ractor) - # Gem::URI::Parser.new - DEFAULT_PARSER = Parser.new - DEFAULT_PARSER.pattern.each_pair do |sym, str| - unless REGEXP::PATTERN.const_defined?(sym) - REGEXP::PATTERN.const_set(sym, str) + RFC3986_PARSER = RFC3986_Parser.new + Ractor.make_shareable(RFC3986_PARSER) if defined?(Ractor) + + DEFAULT_PARSER = RFC3986_PARSER + Ractor.make_shareable(DEFAULT_PARSER) if defined?(Ractor) + + def self.parser=(parser = RFC3986_PARSER) + remove_const(:Parser) if defined?(::Gem::URI::Parser) + const_set("Parser", parser.class) + + remove_const(:REGEXP) if defined?(::Gem::URI::REGEXP) + remove_const(:PATTERN) if defined?(::Gem::URI::PATTERN) + if Parser == RFC2396_Parser + const_set("REGEXP", Gem::URI::RFC2396_REGEXP) + const_set("PATTERN", Gem::URI::RFC2396_REGEXP::PATTERN) + Parser.new.pattern.each_pair do |sym, str| + unless REGEXP::PATTERN.const_defined?(sym) + REGEXP::PATTERN.const_set(sym, str) + end + end + end + + Parser.new.regexp.each_pair do |sym, str| + remove_const(sym) if const_defined?(sym) + const_set(sym, str) end end - DEFAULT_PARSER.regexp.each_pair do |sym, str| - const_set(sym, str) + self.parser = RFC3986_PARSER + + def self.const_missing(const) + if const == :REGEXP + warn "Gem::URI::REGEXP is obsolete. Use Gem::URI::RFC2396_REGEXP explicitly.", uplevel: 1 if $VERBOSE + Gem::URI::RFC2396_REGEXP + elsif value = RFC2396_PARSER.regexp[const] + warn "Gem::URI::#{const} is obsolete. Use RFC2396_PARSER.regexp[#{const.inspect}] explicitly.", uplevel: 1 if $VERBOSE + value + elsif value = RFC2396_Parser.const_get(const) + warn "Gem::URI::#{const} is obsolete. Use RFC2396_Parser::#{const} explicitly.", uplevel: 1 if $VERBOSE + value + else + super + end end - Ractor.make_shareable(DEFAULT_PARSER) if defined?(Ractor) module Util # :nodoc: def make_components_hash(klass, array_hash) @@ -170,7 +196,7 @@ module Gem::URI # ["fragment", "top"]] # def self.split(uri) - RFC3986_PARSER.split(uri) + DEFAULT_PARSER.split(uri) end # Returns a new \Gem::URI object constructed from the given string +uri+: @@ -184,7 +210,7 @@ module Gem::URI # if it may contain invalid Gem::URI characters. # def self.parse(uri) - RFC3986_PARSER.parse(uri) + DEFAULT_PARSER.parse(uri) end # Merges the given Gem::URI strings +str+ @@ -211,7 +237,7 @@ module Gem::URI # # => # # def self.join(*str) - RFC3986_PARSER.join(*str) + DEFAULT_PARSER.join(*str) end # diff --git a/lib/rubygems/vendor/uri/lib/uri/file.rb b/lib/rubygems/vendor/uri/lib/uri/file.rb index d419b26055..768755fc2d 100644 --- a/lib/rubygems/vendor/uri/lib/uri/file.rb +++ b/lib/rubygems/vendor/uri/lib/uri/file.rb @@ -70,17 +70,17 @@ module Gem::URI # raise InvalidURIError def check_userinfo(user) - raise Gem::URI::InvalidURIError, "can not set userinfo for file Gem::URI" + raise Gem::URI::InvalidURIError, "cannot set userinfo for file Gem::URI" end # raise InvalidURIError def check_user(user) - raise Gem::URI::InvalidURIError, "can not set user for file Gem::URI" + raise Gem::URI::InvalidURIError, "cannot set user for file Gem::URI" end # raise InvalidURIError def check_password(user) - raise Gem::URI::InvalidURIError, "can not set password for file Gem::URI" + raise Gem::URI::InvalidURIError, "cannot set password for file Gem::URI" end # do nothing diff --git a/lib/rubygems/vendor/uri/lib/uri/ftp.rb b/lib/rubygems/vendor/uri/lib/uri/ftp.rb index 100498ffb2..7517813029 100644 --- a/lib/rubygems/vendor/uri/lib/uri/ftp.rb +++ b/lib/rubygems/vendor/uri/lib/uri/ftp.rb @@ -17,7 +17,7 @@ module Gem::URI # This class will be redesigned because of difference of implementations; # the structure of its path. draft-hoffman-ftp-uri-04 is a draft but it # is a good summary about the de facto spec. - # http://tools.ietf.org/html/draft-hoffman-ftp-uri-04 + # https://datatracker.ietf.org/doc/html/draft-hoffman-ftp-uri-04 # class FTP < Generic # A Default port of 21 for Gem::URI::FTP. diff --git a/lib/rubygems/vendor/uri/lib/uri/generic.rb b/lib/rubygems/vendor/uri/lib/uri/generic.rb index 72c52aa8ee..06da4a3b4e 100644 --- a/lib/rubygems/vendor/uri/lib/uri/generic.rb +++ b/lib/rubygems/vendor/uri/lib/uri/generic.rb @@ -82,7 +82,7 @@ module Gem::URI if args.kind_of?(Array) return self.build(args.collect{|x| if x.is_a?(String) - DEFAULT_PARSER.escape(x) + Gem::URI::RFC2396_PARSER.escape(x) else x end @@ -91,7 +91,7 @@ module Gem::URI tmp = {} args.each do |key, value| tmp[key] = if value - DEFAULT_PARSER.escape(value) + Gem::URI::RFC2396_PARSER.escape(value) else value end @@ -393,7 +393,7 @@ module Gem::URI def check_user(v) if @opaque raise InvalidURIError, - "can not set user with opaque" + "cannot set user with opaque" end return v unless v @@ -417,7 +417,7 @@ module Gem::URI def check_password(v, user = @user) if @opaque raise InvalidURIError, - "can not set password with opaque" + "cannot set password with opaque" end return v unless v @@ -596,7 +596,7 @@ module Gem::URI if @opaque raise InvalidURIError, - "can not set host with registry or opaque" + "cannot set host with registry or opaque" elsif parser.regexp[:HOST] !~ v raise InvalidComponentError, "bad component(expected host component): #{v}" @@ -685,7 +685,7 @@ module Gem::URI if @opaque raise InvalidURIError, - "can not set port with registry or opaque" + "cannot set port with registry or opaque" elsif !v.kind_of?(Integer) && parser.regexp[:PORT] !~ v raise InvalidComponentError, "bad component(expected port component): #{v.inspect}" @@ -733,17 +733,17 @@ module Gem::URI end def check_registry(v) # :nodoc: - raise InvalidURIError, "can not set registry" + raise InvalidURIError, "cannot set registry" end private :check_registry def set_registry(v) #:nodoc: - raise InvalidURIError, "can not set registry" + raise InvalidURIError, "cannot set registry" end protected :set_registry def registry=(v) - raise InvalidURIError, "can not set registry" + raise InvalidURIError, "cannot set registry" end # @@ -866,7 +866,7 @@ module Gem::URI # hier_part = ( net_path | abs_path ) [ "?" query ] if @host || @port || @user || @path # userinfo = @user + ':' + @password raise InvalidURIError, - "can not set opaque with host, port, userinfo or path" + "cannot set opaque with host, port, userinfo or path" elsif v && parser.regexp[:OPAQUE] !~ v raise InvalidComponentError, "bad component(expected opaque component): #{v}" @@ -945,7 +945,7 @@ module Gem::URI # == Description # # Gem::URI has components listed in order of decreasing significance from left to right, - # see RFC3986 https://tools.ietf.org/html/rfc3986 1.2.3. + # see RFC3986 https://www.rfc-editor.org/rfc/rfc3986 1.2.3. # # == Usage # @@ -1235,7 +1235,7 @@ module Gem::URI return rel, rel end - # you can modify `rel', but can not `oth'. + # you can modify `rel', but cannot `oth'. return oth, rel end private :route_from0 @@ -1260,7 +1260,7 @@ module Gem::URI # #=> # # def route_from(oth) - # you can modify `rel', but can not `oth'. + # you can modify `rel', but cannot `oth'. begin oth, rel = route_from0(oth) rescue @@ -1364,6 +1364,9 @@ module Gem::URI str << ':' str << @port.to_s end + if (@host || @port) && !@path.empty? && !@path.start_with?('/') + str << '/' + end str << @path if @query str << '?' @@ -1399,19 +1402,6 @@ module Gem::URI self.component_ary.eql?(oth.component_ary) end -=begin - ---- Gem::URI::Generic#===(oth) - -=end -# def ===(oth) -# raise NotImplementedError -# end - -=begin -=end - - # Returns an Array of the components defined from the COMPONENT Array. def component_ary component.collect do |x| diff --git a/lib/rubygems/vendor/uri/lib/uri/http.rb b/lib/rubygems/vendor/uri/lib/uri/http.rb index bef43490a3..658e9941dd 100644 --- a/lib/rubygems/vendor/uri/lib/uri/http.rb +++ b/lib/rubygems/vendor/uri/lib/uri/http.rb @@ -85,7 +85,7 @@ module Gem::URI # == Description # # Returns the authority for an HTTP uri, as defined in - # https://datatracker.ietf.org/doc/html/rfc3986/#section-3.2. + # https://www.rfc-editor.org/rfc/rfc3986#section-3.2. # # # Example: @@ -106,7 +106,7 @@ module Gem::URI # == Description # # Returns the origin for an HTTP uri, as defined in - # https://datatracker.ietf.org/doc/html/rfc6454. + # https://www.rfc-editor.org/rfc/rfc6454. # # # Example: diff --git a/lib/rubygems/vendor/uri/lib/uri/rfc2396_parser.rb b/lib/rubygems/vendor/uri/lib/uri/rfc2396_parser.rb index 735a269f2c..d222bdc438 100644 --- a/lib/rubygems/vendor/uri/lib/uri/rfc2396_parser.rb +++ b/lib/rubygems/vendor/uri/lib/uri/rfc2396_parser.rb @@ -140,11 +140,11 @@ module Gem::URI if !scheme raise InvalidURIError, - "bad Gem::URI(absolute but no scheme): #{uri}" + "bad Gem::URI (absolute but no scheme): #{uri}" end if !opaque && (!path && (!host && !registry)) raise InvalidURIError, - "bad Gem::URI(absolute but no path): #{uri}" + "bad Gem::URI (absolute but no path): #{uri}" end when @regexp[:REL_URI] @@ -173,7 +173,7 @@ module Gem::URI # server = [ [ userinfo "@" ] hostport ] else - raise InvalidURIError, "bad Gem::URI(is not Gem::URI?): #{uri}" + raise InvalidURIError, "bad Gem::URI (is not Gem::URI?): #{uri}" end path = '' if !path && !opaque # (see RFC2396 Section 5.2) diff --git a/lib/rubygems/vendor/uri/lib/uri/rfc3986_parser.rb b/lib/rubygems/vendor/uri/lib/uri/rfc3986_parser.rb index 728bb55674..53dec866c2 100644 --- a/lib/rubygems/vendor/uri/lib/uri/rfc3986_parser.rb +++ b/lib/rubygems/vendor/uri/lib/uri/rfc3986_parser.rb @@ -78,7 +78,7 @@ module Gem::URI begin uri = uri.to_str rescue NoMethodError - raise InvalidURIError, "bad Gem::URI(is not Gem::URI?): #{uri.inspect}" + raise InvalidURIError, "bad Gem::URI (is not Gem::URI?): #{uri.inspect}" end uri.ascii_only? or raise InvalidURIError, "Gem::URI must be ascii only #{uri.dump}" @@ -127,7 +127,7 @@ module Gem::URI m["fragment"] ] else - raise InvalidURIError, "bad Gem::URI(is not Gem::URI?): #{uri.inspect}" + raise InvalidURIError, "bad Gem::URI (is not Gem::URI?): #{uri.inspect}" end end @@ -135,12 +135,35 @@ module Gem::URI Gem::URI.for(*self.split(uri), self) end - def join(*uris) # :nodoc: uris[0] = convert_to_uri(uris[0]) uris.inject :merge end + # Compatibility for RFC2396 parser + def extract(str, schemes = nil, &block) # :nodoc: + warn "Gem::URI::RFC3986_PARSER.extract is obsoleted. Use Gem::URI::RFC2396_PARSER.extract explicitly.", uplevel: 1 if $VERBOSE + RFC2396_PARSER.extract(str, schemes, &block) + end + + # Compatibility for RFC2396 parser + def make_regexp(schemes = nil) # :nodoc: + warn "Gem::URI::RFC3986_PARSER.make_regexp is obsoleted. Use Gem::URI::RFC2396_PARSER.make_regexp explicitly.", uplevel: 1 if $VERBOSE + RFC2396_PARSER.make_regexp(schemes) + end + + # Compatibility for RFC2396 parser + def escape(str, unsafe = nil) # :nodoc: + warn "Gem::URI::RFC3986_PARSER.escape is obsoleted. Use Gem::URI::RFC2396_PARSER.escape explicitly.", uplevel: 1 if $VERBOSE + unsafe ? RFC2396_PARSER.escape(str, unsafe) : RFC2396_PARSER.escape(str) + end + + # Compatibility for RFC2396 parser + def unescape(str, escaped = nil) # :nodoc: + warn "Gem::URI::RFC3986_PARSER.unescape is obsoleted. Use Gem::URI::RFC2396_PARSER.unescape explicitly.", uplevel: 1 if $VERBOSE + escaped ? RFC2396_PARSER.unescape(str, escaped) : RFC2396_PARSER.unescape(str) + end + @@to_s = Kernel.instance_method(:to_s) if @@to_s.respond_to?(:bind_call) def inspect diff --git a/lib/rubygems/vendor/uri/lib/uri/version.rb b/lib/rubygems/vendor/uri/lib/uri/version.rb index 080744095c..ce9ab59580 100644 --- a/lib/rubygems/vendor/uri/lib/uri/version.rb +++ b/lib/rubygems/vendor/uri/lib/uri/version.rb @@ -1,6 +1,6 @@ module Gem::URI # :stopdoc: - VERSION_CODE = '001301'.freeze + VERSION_CODE = '010001'.freeze VERSION = VERSION_CODE.scan(/../).collect{|n| n.to_i}.join('.').freeze # :startdoc: end diff --git a/tool/bundler/vendor_gems.rb b/tool/bundler/vendor_gems.rb index 4b7cdb67be..85b38c4cf3 100644 --- a/tool/bundler/vendor_gems.rb +++ b/tool/bundler/vendor_gems.rb @@ -14,3 +14,4 @@ gem "securerandom", "0.3.1" gem "timeout", "0.4.1" gem "thor", "1.3.0" gem "tsort", "0.2.0" +gem "uri", "1.0.1"