parent
6d00053c74
commit
3e00cb8256
Notes:
git
2022-12-13 03:41:26 +00:00
@ -109,8 +109,10 @@ module Bundler
|
||||
|
||||
def strict_rm_rf(dir)
|
||||
Bundler.rm_rf dir
|
||||
rescue Errno::ENOTEMPTY => e
|
||||
raise DirectoryRemovalError.new(e.cause, "Could not delete previous installation of `#{dir}`")
|
||||
rescue StandardError => e
|
||||
raise unless File.exist?(dir)
|
||||
|
||||
raise DirectoryRemovalError.new(e, "Could not delete previous installation of `#{dir}`")
|
||||
end
|
||||
|
||||
def validate_bundler_checksum(checksum)
|
||||
|
@ -3,7 +3,9 @@ require_relative "connection_pool/version"
|
||||
|
||||
class Bundler::ConnectionPool
|
||||
class Error < ::RuntimeError; end
|
||||
|
||||
class PoolShuttingDownError < ::Bundler::ConnectionPool::Error; end
|
||||
|
||||
class TimeoutError < ::Timeout::Error; end
|
||||
end
|
||||
|
||||
@ -67,7 +69,7 @@ class Bundler::ConnectionPool
|
||||
end
|
||||
end
|
||||
end
|
||||
alias then with
|
||||
alias_method :then, :with
|
||||
|
||||
def checkout(options = {})
|
||||
if ::Thread.current[@key]
|
||||
|
@ -49,7 +49,7 @@ class Bundler::ConnectionPool::TimedStack
|
||||
@resource.broadcast
|
||||
end
|
||||
end
|
||||
alias << push
|
||||
alias_method :<<, :push
|
||||
|
||||
##
|
||||
# Retrieves a connection from the stack. If a connection is available it is
|
||||
@ -74,7 +74,7 @@ class Bundler::ConnectionPool::TimedStack
|
||||
return connection if connection
|
||||
|
||||
to_wait = deadline - current_time
|
||||
raise Bundler::ConnectionPool::TimeoutError, "Waited #{timeout} sec" if to_wait <= 0
|
||||
raise Bundler::ConnectionPool::TimeoutError, "Waited #{timeout} sec, #{length}/#{@max} available" if to_wait <= 0
|
||||
@resource.wait(@mutex, to_wait)
|
||||
end
|
||||
end
|
||||
@ -87,7 +87,7 @@ class Bundler::ConnectionPool::TimedStack
|
||||
# +:reload+ is +true+.
|
||||
|
||||
def shutdown(reload: false, &block)
|
||||
raise ArgumentError, "shutdown must receive a block" unless block_given?
|
||||
raise ArgumentError, "shutdown must receive a block" unless block
|
||||
|
||||
@mutex.synchronize do
|
||||
@shutdown_block = block
|
||||
|
@ -30,7 +30,6 @@ class Bundler::ConnectionPool
|
||||
METHODS.include?(id) || with { |c| c.respond_to?(id, *args) }
|
||||
end
|
||||
|
||||
# rubocop:disable Style/MethodMissingSuper
|
||||
# rubocop:disable Style/MissingRespondToMissing
|
||||
if ::RUBY_VERSION >= "3.0.0"
|
||||
def method_missing(name, *args, **kwargs, &block)
|
||||
|
1716
lib/bundler/vendor/fileutils/lib/fileutils.rb
vendored
1716
lib/bundler/vendor/fileutils/lib/fileutils.rb
vendored
File diff suppressed because it is too large
Load Diff
5
lib/bundler/vendor/uri/lib/uri.rb
vendored
5
lib/bundler/vendor/uri/lib/uri.rb
vendored
@ -30,7 +30,7 @@
|
||||
# class RSYNC < Generic
|
||||
# DEFAULT_PORT = 873
|
||||
# end
|
||||
# @@schemes['RSYNC'] = RSYNC
|
||||
# register_scheme 'RSYNC', RSYNC
|
||||
# end
|
||||
# #=> Bundler::URI::RSYNC
|
||||
#
|
||||
@ -70,7 +70,6 @@
|
||||
# - Bundler::URI::REGEXP - (in uri/common.rb)
|
||||
# - Bundler::URI::REGEXP::PATTERN - (in uri/common.rb)
|
||||
# - Bundler::URI::Util - (in uri/common.rb)
|
||||
# - Bundler::URI::Escape - (in uri/common.rb)
|
||||
# - Bundler::URI::Error - (in uri/common.rb)
|
||||
# - Bundler::URI::InvalidURIError - (in uri/common.rb)
|
||||
# - Bundler::URI::InvalidComponentError - (in uri/common.rb)
|
||||
@ -101,3 +100,5 @@ require_relative 'uri/https'
|
||||
require_relative 'uri/ldap'
|
||||
require_relative 'uri/ldaps'
|
||||
require_relative 'uri/mailto'
|
||||
require_relative 'uri/ws'
|
||||
require_relative 'uri/wss'
|
||||
|
86
lib/bundler/vendor/uri/lib/uri/common.rb
vendored
86
lib/bundler/vendor/uri/lib/uri/common.rb
vendored
@ -13,9 +13,12 @@ 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)
|
||||
|
||||
# Bundler::URI::Parser.new
|
||||
DEFAULT_PARSER = Parser.new
|
||||
@ -27,6 +30,7 @@ module Bundler::URI
|
||||
DEFAULT_PARSER.regexp.each_pair do |sym, str|
|
||||
const_set(sym, str)
|
||||
end
|
||||
Ractor.make_shareable(DEFAULT_PARSER) if defined?(Ractor)
|
||||
|
||||
module Util # :nodoc:
|
||||
def make_components_hash(klass, array_hash)
|
||||
@ -60,24 +64,42 @@ module Bundler::URI
|
||||
module_function :make_components_hash
|
||||
end
|
||||
|
||||
include REGEXP
|
||||
module Schemes
|
||||
end
|
||||
private_constant :Schemes
|
||||
|
||||
#
|
||||
# Register the given +klass+ to be instantiated when parsing URLs with the given +scheme+.
|
||||
# Note that currently only schemes which after .upcase are valid constant names
|
||||
# can be registered (no -/+/. allowed).
|
||||
#
|
||||
def self.register_scheme(scheme, klass)
|
||||
Schemes.const_set(scheme.to_s.upcase, klass)
|
||||
end
|
||||
|
||||
@@schemes = {}
|
||||
# Returns a Hash of the defined schemes.
|
||||
def self.scheme_list
|
||||
@@schemes
|
||||
Schemes.constants.map { |name|
|
||||
[name.to_s.upcase, Schemes.const_get(name)]
|
||||
}.to_h
|
||||
end
|
||||
|
||||
INITIAL_SCHEMES = scheme_list
|
||||
private_constant :INITIAL_SCHEMES
|
||||
Ractor.make_shareable(INITIAL_SCHEMES) if defined?(Ractor)
|
||||
|
||||
#
|
||||
# Construct a Bundler::URI instance, using the scheme to detect the appropriate class
|
||||
# from +Bundler::URI.scheme_list+.
|
||||
#
|
||||
def self.for(scheme, *arguments, default: Generic)
|
||||
if scheme
|
||||
uri_class = @@schemes[scheme.upcase] || default
|
||||
else
|
||||
uri_class = default
|
||||
const_name = scheme.to_s.upcase
|
||||
|
||||
uri_class = INITIAL_SCHEMES[const_name]
|
||||
uri_class ||= if /\A[A-Z]\w*\z/.match?(const_name) && Schemes.const_defined?(const_name, false)
|
||||
Schemes.const_get(const_name, false)
|
||||
end
|
||||
uri_class ||= default
|
||||
|
||||
return uri_class.new(scheme, *arguments)
|
||||
end
|
||||
@ -278,6 +300,7 @@ module Bundler::URI
|
||||
256.times do |i|
|
||||
TBLENCWWWCOMP_[-i.chr] = -('%%%02X' % i)
|
||||
end
|
||||
TBLENCURICOMP_ = TBLENCWWWCOMP_.dup.freeze
|
||||
TBLENCWWWCOMP_[' '] = '+'
|
||||
TBLENCWWWCOMP_.freeze
|
||||
TBLDECWWWCOMP_ = {} # :nodoc:
|
||||
@ -303,16 +326,7 @@ module Bundler::URI
|
||||
#
|
||||
# See Bundler::URI.decode_www_form_component, Bundler::URI.encode_www_form.
|
||||
def self.encode_www_form_component(str, enc=nil)
|
||||
str = str.to_s.dup
|
||||
if str.encoding != Encoding::ASCII_8BIT
|
||||
if enc && enc != Encoding::ASCII_8BIT
|
||||
str.encode!(Encoding::UTF_8, invalid: :replace, undef: :replace)
|
||||
str.encode!(enc, fallback: ->(x){"&##{x.ord};"})
|
||||
end
|
||||
str.force_encoding(Encoding::ASCII_8BIT)
|
||||
end
|
||||
str.gsub!(/[^*\-.0-9A-Z_a-z]/, TBLENCWWWCOMP_)
|
||||
str.force_encoding(Encoding::US_ASCII)
|
||||
_encode_uri_component(/[^*\-.0-9A-Z_a-z]/, TBLENCWWWCOMP_, str, enc)
|
||||
end
|
||||
|
||||
# Decodes given +str+ of URL-encoded form data.
|
||||
@ -321,10 +335,43 @@ module Bundler::URI
|
||||
#
|
||||
# See Bundler::URI.encode_www_form_component, Bundler::URI.decode_www_form.
|
||||
def self.decode_www_form_component(str, enc=Encoding::UTF_8)
|
||||
raise ArgumentError, "invalid %-encoding (#{str})" if /%(?!\h\h)/ =~ str
|
||||
str.b.gsub(/\+|%\h\h/, TBLDECWWWCOMP_).force_encoding(enc)
|
||||
_decode_uri_component(/\+|%\h\h/, str, enc)
|
||||
end
|
||||
|
||||
# Encodes +str+ using URL encoding
|
||||
#
|
||||
# This encodes SP to %20 instead of +.
|
||||
def self.encode_uri_component(str, enc=nil)
|
||||
_encode_uri_component(/[^*\-.0-9A-Z_a-z]/, TBLENCURICOMP_, str, enc)
|
||||
end
|
||||
|
||||
# Decodes given +str+ of URL-encoded data.
|
||||
#
|
||||
# This does not decode + to SP.
|
||||
def self.decode_uri_component(str, enc=Encoding::UTF_8)
|
||||
_decode_uri_component(/%\h\h/, str, enc)
|
||||
end
|
||||
|
||||
def self._encode_uri_component(regexp, table, str, enc)
|
||||
str = str.to_s.dup
|
||||
if str.encoding != Encoding::ASCII_8BIT
|
||||
if enc && enc != Encoding::ASCII_8BIT
|
||||
str.encode!(Encoding::UTF_8, invalid: :replace, undef: :replace)
|
||||
str.encode!(enc, fallback: ->(x){"&##{x.ord};"})
|
||||
end
|
||||
str.force_encoding(Encoding::ASCII_8BIT)
|
||||
end
|
||||
str.gsub!(regexp, table)
|
||||
str.force_encoding(Encoding::US_ASCII)
|
||||
end
|
||||
private_class_method :_encode_uri_component
|
||||
|
||||
def self._decode_uri_component(regexp, str, enc)
|
||||
raise ArgumentError, "invalid %-encoding (#{str})" if /%(?!\h\h)/.match?(str)
|
||||
str.b.gsub(regexp, TBLDECWWWCOMP_).force_encoding(enc)
|
||||
end
|
||||
private_class_method :_decode_uri_component
|
||||
|
||||
# Generates URL-encoded form data from given +enum+.
|
||||
#
|
||||
# This generates application/x-www-form-urlencoded data defined in HTML5
|
||||
@ -653,6 +700,7 @@ module Bundler::URI
|
||||
"utf-16"=>"utf-16le",
|
||||
"utf-16le"=>"utf-16le",
|
||||
} # :nodoc:
|
||||
Ractor.make_shareable(WEB_ENCODINGS_) if defined?(Ractor)
|
||||
|
||||
# :nodoc:
|
||||
# return encoding or nil
|
||||
|
8
lib/bundler/vendor/uri/lib/uri/file.rb
vendored
8
lib/bundler/vendor/uri/lib/uri/file.rb
vendored
@ -33,6 +33,9 @@ module Bundler::URI
|
||||
# If an Array is used, the components must be passed in the
|
||||
# order <code>[host, path]</code>.
|
||||
#
|
||||
# A path from e.g. the File class should be escaped before
|
||||
# being passed.
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# require 'bundler/vendor/uri/lib/uri'
|
||||
@ -44,6 +47,9 @@ module Bundler::URI
|
||||
# :path => '/ruby/src'})
|
||||
# uri2.to_s # => "file://host.example.com/ruby/src"
|
||||
#
|
||||
# uri3 = Bundler::URI::File.build({:path => Bundler::URI::escape('/path/my file.txt')})
|
||||
# uri3.to_s # => "file:///path/my%20file.txt"
|
||||
#
|
||||
def self.build(args)
|
||||
tmp = Util::make_components_hash(self, args)
|
||||
super(tmp)
|
||||
@ -90,5 +96,5 @@ module Bundler::URI
|
||||
end
|
||||
end
|
||||
|
||||
@@schemes['FILE'] = File
|
||||
register_scheme 'FILE', File
|
||||
end
|
||||
|
3
lib/bundler/vendor/uri/lib/uri/ftp.rb
vendored
3
lib/bundler/vendor/uri/lib/uri/ftp.rb
vendored
@ -262,5 +262,6 @@ module Bundler::URI
|
||||
return str
|
||||
end
|
||||
end
|
||||
@@schemes['FTP'] = FTP
|
||||
|
||||
register_scheme 'FTP', FTP
|
||||
end
|
||||
|
34
lib/bundler/vendor/uri/lib/uri/generic.rb
vendored
34
lib/bundler/vendor/uri/lib/uri/generic.rb
vendored
@ -564,16 +564,26 @@ module Bundler::URI
|
||||
end
|
||||
end
|
||||
|
||||
# Returns the user component.
|
||||
# Returns the user component (without Bundler::URI decoding).
|
||||
def user
|
||||
@user
|
||||
end
|
||||
|
||||
# Returns the password component.
|
||||
# Returns the password component (without Bundler::URI decoding).
|
||||
def password
|
||||
@password
|
||||
end
|
||||
|
||||
# Returns the user component after Bundler::URI decoding.
|
||||
def decoded_user
|
||||
Bundler::URI.decode_uri_component(@user) if @user
|
||||
end
|
||||
|
||||
# Returns the password component after Bundler::URI decoding.
|
||||
def decoded_password
|
||||
Bundler::URI.decode_uri_component(@password) if @password
|
||||
end
|
||||
|
||||
#
|
||||
# Checks the host +v+ component for RFC2396 compliance
|
||||
# and against the Bundler::URI::Parser Regexp for :HOST.
|
||||
@ -643,7 +653,7 @@ module Bundler::URI
|
||||
#
|
||||
def hostname
|
||||
v = self.host
|
||||
/\A\[(.*)\]\z/ =~ v ? $1 : v
|
||||
v&.start_with?('[') && v.end_with?(']') ? v[1..-2] : v
|
||||
end
|
||||
|
||||
# Sets the host part of the Bundler::URI as the argument with brackets for IPv6 addresses.
|
||||
@ -659,7 +669,7 @@ module Bundler::URI
|
||||
# it is wrapped with brackets.
|
||||
#
|
||||
def hostname=(v)
|
||||
v = "[#{v}]" if /\A\[.*\]\z/ !~ v && /:/ =~ v
|
||||
v = "[#{v}]" if !(v&.start_with?('[') && v&.end_with?(']')) && v&.index(':')
|
||||
self.host = v
|
||||
end
|
||||
|
||||
@ -1514,9 +1524,19 @@ module Bundler::URI
|
||||
proxy_uri = env["CGI_#{name.upcase}"]
|
||||
end
|
||||
elsif name == 'http_proxy'
|
||||
unless proxy_uri = env[name]
|
||||
if proxy_uri = env[name.upcase]
|
||||
warn 'The environment variable HTTP_PROXY is discouraged. Use http_proxy.', uplevel: 1
|
||||
if RUBY_ENGINE == 'jruby' && p_addr = ENV_JAVA['http.proxyHost']
|
||||
p_port = ENV_JAVA['http.proxyPort']
|
||||
if p_user = ENV_JAVA['http.proxyUser']
|
||||
p_pass = ENV_JAVA['http.proxyPass']
|
||||
proxy_uri = "http://#{p_user}:#{p_pass}@#{p_addr}:#{p_port}"
|
||||
else
|
||||
proxy_uri = "http://#{p_addr}:#{p_port}"
|
||||
end
|
||||
else
|
||||
unless proxy_uri = env[name]
|
||||
if proxy_uri = env[name.upcase]
|
||||
warn 'The environment variable HTTP_PROXY is discouraged. Use http_proxy.', uplevel: 1
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
|
42
lib/bundler/vendor/uri/lib/uri/http.rb
vendored
42
lib/bundler/vendor/uri/lib/uri/http.rb
vendored
@ -80,8 +80,46 @@ module Bundler::URI
|
||||
url = @query ? "#@path?#@query" : @path.dup
|
||||
url.start_with?(?/.freeze) ? url : ?/ + url
|
||||
end
|
||||
|
||||
#
|
||||
# == Description
|
||||
#
|
||||
# Returns the authority for an HTTP uri, as defined in
|
||||
# https://datatracker.ietf.org/doc/html/rfc3986/#section-3.2.
|
||||
#
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# Bundler::URI::HTTP.build(host: 'www.example.com', path: '/foo/bar').authority #=> "www.example.com"
|
||||
# Bundler::URI::HTTP.build(host: 'www.example.com', port: 8000, path: '/foo/bar').authority #=> "www.example.com:8000"
|
||||
# Bundler::URI::HTTP.build(host: 'www.example.com', port: 80, path: '/foo/bar').authority #=> "www.example.com"
|
||||
#
|
||||
def authority
|
||||
if port == default_port
|
||||
host
|
||||
else
|
||||
"#{host}:#{port}"
|
||||
end
|
||||
end
|
||||
|
||||
#
|
||||
# == Description
|
||||
#
|
||||
# Returns the origin for an HTTP uri, as defined in
|
||||
# https://datatracker.ietf.org/doc/html/rfc6454.
|
||||
#
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# Bundler::URI::HTTP.build(host: 'www.example.com', path: '/foo/bar').origin #=> "http://www.example.com"
|
||||
# Bundler::URI::HTTP.build(host: 'www.example.com', port: 8000, path: '/foo/bar').origin #=> "http://www.example.com:8000"
|
||||
# Bundler::URI::HTTP.build(host: 'www.example.com', port: 80, path: '/foo/bar').origin #=> "http://www.example.com"
|
||||
# Bundler::URI::HTTPS.build(host: 'www.example.com', path: '/foo/bar').origin #=> "https://www.example.com"
|
||||
#
|
||||
def origin
|
||||
"#{scheme}://#{authority}"
|
||||
end
|
||||
end
|
||||
|
||||
@@schemes['HTTP'] = HTTP
|
||||
|
||||
register_scheme 'HTTP', HTTP
|
||||
end
|
||||
|
3
lib/bundler/vendor/uri/lib/uri/https.rb
vendored
3
lib/bundler/vendor/uri/lib/uri/https.rb
vendored
@ -18,5 +18,6 @@ module Bundler::URI
|
||||
# A Default port of 443 for Bundler::URI::HTTPS
|
||||
DEFAULT_PORT = 443
|
||||
end
|
||||
@@schemes['HTTPS'] = HTTPS
|
||||
|
||||
register_scheme 'HTTPS', HTTPS
|
||||
end
|
||||
|
2
lib/bundler/vendor/uri/lib/uri/ldap.rb
vendored
2
lib/bundler/vendor/uri/lib/uri/ldap.rb
vendored
@ -257,5 +257,5 @@ module Bundler::URI
|
||||
end
|
||||
end
|
||||
|
||||
@@schemes['LDAP'] = LDAP
|
||||
register_scheme 'LDAP', LDAP
|
||||
end
|
||||
|
3
lib/bundler/vendor/uri/lib/uri/ldaps.rb
vendored
3
lib/bundler/vendor/uri/lib/uri/ldaps.rb
vendored
@ -17,5 +17,6 @@ module Bundler::URI
|
||||
# A Default port of 636 for Bundler::URI::LDAPS
|
||||
DEFAULT_PORT = 636
|
||||
end
|
||||
@@schemes['LDAPS'] = LDAPS
|
||||
|
||||
register_scheme 'LDAPS', LDAPS
|
||||
end
|
||||
|
4
lib/bundler/vendor/uri/lib/uri/mailto.rb
vendored
4
lib/bundler/vendor/uri/lib/uri/mailto.rb
vendored
@ -15,7 +15,7 @@ module Bundler::URI
|
||||
# RFC6068, the mailto URL scheme.
|
||||
#
|
||||
class MailTo < Generic
|
||||
include REGEXP
|
||||
include RFC2396_REGEXP
|
||||
|
||||
# A Default port of nil for Bundler::URI::MailTo.
|
||||
DEFAULT_PORT = nil
|
||||
@ -289,5 +289,5 @@ module Bundler::URI
|
||||
alias to_rfc822text to_mailtext
|
||||
end
|
||||
|
||||
@@schemes['MAILTO'] = MailTo
|
||||
register_scheme 'MAILTO', MailTo
|
||||
end
|
||||
|
20
lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb
vendored
20
lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb
vendored
@ -116,7 +116,7 @@ module Bundler::URI
|
||||
# See also Bundler::URI::Parser.initialize_regexp.
|
||||
attr_reader :regexp
|
||||
|
||||
# Returns a split Bundler::URI against regexp[:ABS_URI].
|
||||
# Returns a split Bundler::URI against +regexp[:ABS_URI]+.
|
||||
def split(uri)
|
||||
case uri
|
||||
when ''
|
||||
@ -257,8 +257,8 @@ module Bundler::URI
|
||||
end
|
||||
end
|
||||
|
||||
# Returns Regexp that is default self.regexp[:ABS_URI_REF],
|
||||
# unless +schemes+ is provided. Then it is a Regexp.union with self.pattern[:X_ABS_URI].
|
||||
# Returns Regexp that is default +self.regexp[:ABS_URI_REF]+,
|
||||
# unless +schemes+ is provided. Then it is a Regexp.union with +self.pattern[:X_ABS_URI]+.
|
||||
def make_regexp(schemes = nil)
|
||||
unless schemes
|
||||
@regexp[:ABS_URI_REF]
|
||||
@ -277,7 +277,7 @@ module Bundler::URI
|
||||
# +str+::
|
||||
# String to make safe
|
||||
# +unsafe+::
|
||||
# Regexp to apply. Defaults to self.regexp[:UNSAFE]
|
||||
# Regexp to apply. Defaults to +self.regexp[:UNSAFE]+
|
||||
#
|
||||
# == Description
|
||||
#
|
||||
@ -309,7 +309,7 @@ module Bundler::URI
|
||||
# +str+::
|
||||
# String to remove escapes from
|
||||
# +escaped+::
|
||||
# Regexp to apply. Defaults to self.regexp[:ESCAPED]
|
||||
# Regexp to apply. Defaults to +self.regexp[:ESCAPED]+
|
||||
#
|
||||
# == Description
|
||||
#
|
||||
@ -322,8 +322,14 @@ module Bundler::URI
|
||||
end
|
||||
|
||||
@@to_s = Kernel.instance_method(:to_s)
|
||||
def inspect
|
||||
@@to_s.bind_call(self)
|
||||
if @@to_s.respond_to?(:bind_call)
|
||||
def inspect
|
||||
@@to_s.bind_call(self)
|
||||
end
|
||||
else
|
||||
def inspect
|
||||
@@to_s.bind(self).call
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
15
lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb
vendored
15
lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb
vendored
@ -2,9 +2,8 @@
|
||||
module Bundler::URI
|
||||
class RFC3986_Parser # :nodoc:
|
||||
# Bundler::URI defined in RFC3986
|
||||
# this regexp is modified not to host is not empty string
|
||||
RFC3986_URI = /\A(?<Bundler::URI>(?<scheme>[A-Za-z][+\-.0-9A-Za-z]*):(?<hier-part>\/\/(?<authority>(?:(?<userinfo>(?:%\h\h|[!$&-.0-;=A-Z_a-z~])*)@)?(?<host>(?<IP-literal>\[(?:(?<IPv6address>(?:\h{1,4}:){6}(?<ls32>\h{1,4}:\h{1,4}|(?<IPv4address>(?<dec-octet>[1-9]\d|1\d{2}|2[0-4]\d|25[0-5]|\d)\.\g<dec-octet>\.\g<dec-octet>\.\g<dec-octet>))|::(?:\h{1,4}:){5}\g<ls32>|\h{1,4}?::(?:\h{1,4}:){4}\g<ls32>|(?:(?:\h{1,4}:)?\h{1,4})?::(?:\h{1,4}:){3}\g<ls32>|(?:(?:\h{1,4}:){,2}\h{1,4})?::(?:\h{1,4}:){2}\g<ls32>|(?:(?:\h{1,4}:){,3}\h{1,4})?::\h{1,4}:\g<ls32>|(?:(?:\h{1,4}:){,4}\h{1,4})?::\g<ls32>|(?:(?:\h{1,4}:){,5}\h{1,4})?::\h{1,4}|(?:(?:\h{1,4}:){,6}\h{1,4})?::)|(?<IPvFuture>v\h+\.[!$&-.0-;=A-Z_a-z~]+))\])|\g<IPv4address>|(?<reg-name>(?:%\h\h|[!$&-.0-9;=A-Z_a-z~])+))?(?::(?<port>\d*))?)(?<path-abempty>(?:\/(?<segment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*))*)|(?<path-absolute>\/(?:(?<segment-nz>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])+)(?:\/\g<segment>)*)?)|(?<path-rootless>\g<segment-nz>(?:\/\g<segment>)*)|(?<path-empty>))(?:\?(?<query>[^#]*))?(?:\#(?<fragment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*))?)\z/
|
||||
RFC3986_relative_ref = /\A(?<relative-ref>(?<relative-part>\/\/(?<authority>(?:(?<userinfo>(?:%\h\h|[!$&-.0-;=A-Z_a-z~])*)@)?(?<host>(?<IP-literal>\[(?<IPv6address>(?:\h{1,4}:){6}(?<ls32>\h{1,4}:\h{1,4}|(?<IPv4address>(?<dec-octet>[1-9]\d|1\d{2}|2[0-4]\d|25[0-5]|\d)\.\g<dec-octet>\.\g<dec-octet>\.\g<dec-octet>))|::(?:\h{1,4}:){5}\g<ls32>|\h{1,4}?::(?:\h{1,4}:){4}\g<ls32>|(?:(?:\h{1,4}:){,1}\h{1,4})?::(?:\h{1,4}:){3}\g<ls32>|(?:(?:\h{1,4}:){,2}\h{1,4})?::(?:\h{1,4}:){2}\g<ls32>|(?:(?:\h{1,4}:){,3}\h{1,4})?::\h{1,4}:\g<ls32>|(?:(?:\h{1,4}:){,4}\h{1,4})?::\g<ls32>|(?:(?:\h{1,4}:){,5}\h{1,4})?::\h{1,4}|(?:(?:\h{1,4}:){,6}\h{1,4})?::)|(?<IPvFuture>v\h+\.[!$&-.0-;=A-Z_a-z~]+)\])|\g<IPv4address>|(?<reg-name>(?:%\h\h|[!$&-.0-9;=A-Z_a-z~])+))?(?::(?<port>\d*))?)(?<path-abempty>(?:\/(?<segment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*))*)|(?<path-absolute>\/(?:(?<segment-nz>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])+)(?:\/\g<segment>)*)?)|(?<path-noscheme>(?<segment-nz-nc>(?:%\h\h|[!$&-.0-9;=@-Z_a-z~])+)(?:\/\g<segment>)*)|(?<path-empty>))(?:\?(?<query>[^#]*))?(?:\#(?<fragment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*))?)\z/
|
||||
RFC3986_URI = /\A(?<Bundler::URI>(?<scheme>[A-Za-z][+\-.0-9A-Za-z]*):(?<hier-part>\/\/(?<authority>(?:(?<userinfo>(?:%\h\h|[!$&-.0-;=A-Z_a-z~])*)@)?(?<host>(?<IP-literal>\[(?:(?<IPv6address>(?:\h{1,4}:){6}(?<ls32>\h{1,4}:\h{1,4}|(?<IPv4address>(?<dec-octet>[1-9]\d|1\d{2}|2[0-4]\d|25[0-5]|\d)\.\g<dec-octet>\.\g<dec-octet>\.\g<dec-octet>))|::(?:\h{1,4}:){5}\g<ls32>|\h{1,4}?::(?:\h{1,4}:){4}\g<ls32>|(?:(?:\h{1,4}:)?\h{1,4})?::(?:\h{1,4}:){3}\g<ls32>|(?:(?:\h{1,4}:){,2}\h{1,4})?::(?:\h{1,4}:){2}\g<ls32>|(?:(?:\h{1,4}:){,3}\h{1,4})?::\h{1,4}:\g<ls32>|(?:(?:\h{1,4}:){,4}\h{1,4})?::\g<ls32>|(?:(?:\h{1,4}:){,5}\h{1,4})?::\h{1,4}|(?:(?:\h{1,4}:){,6}\h{1,4})?::)|(?<IPvFuture>v\h+\.[!$&-.0-;=A-Z_a-z~]+))\])|\g<IPv4address>|(?<reg-name>(?:%\h\h|[!$&-.0-9;=A-Z_a-z~])*))(?::(?<port>\d*))?)(?<path-abempty>(?:\/(?<segment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*))*)|(?<path-absolute>\/(?:(?<segment-nz>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])+)(?:\/\g<segment>)*)?)|(?<path-rootless>\g<segment-nz>(?:\/\g<segment>)*)|(?<path-empty>))(?:\?(?<query>[^#]*))?(?:\#(?<fragment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*))?)\z/
|
||||
RFC3986_relative_ref = /\A(?<relative-ref>(?<relative-part>\/\/(?<authority>(?:(?<userinfo>(?:%\h\h|[!$&-.0-;=A-Z_a-z~])*)@)?(?<host>(?<IP-literal>\[(?:(?<IPv6address>(?:\h{1,4}:){6}(?<ls32>\h{1,4}:\h{1,4}|(?<IPv4address>(?<dec-octet>[1-9]\d|1\d{2}|2[0-4]\d|25[0-5]|\d)\.\g<dec-octet>\.\g<dec-octet>\.\g<dec-octet>))|::(?:\h{1,4}:){5}\g<ls32>|\h{1,4}?::(?:\h{1,4}:){4}\g<ls32>|(?:(?:\h{1,4}:){,1}\h{1,4})?::(?:\h{1,4}:){3}\g<ls32>|(?:(?:\h{1,4}:){,2}\h{1,4})?::(?:\h{1,4}:){2}\g<ls32>|(?:(?:\h{1,4}:){,3}\h{1,4})?::\h{1,4}:\g<ls32>|(?:(?:\h{1,4}:){,4}\h{1,4})?::\g<ls32>|(?:(?:\h{1,4}:){,5}\h{1,4})?::\h{1,4}|(?:(?:\h{1,4}:){,6}\h{1,4})?::)|(?<IPvFuture>v\h+\.[!$&-.0-;=A-Z_a-z~]+))\])|\g<IPv4address>|(?<reg-name>(?:%\h\h|[!$&-.0-9;=A-Z_a-z~])+))?(?::(?<port>\d*))?)(?<path-abempty>(?:\/(?<segment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*))*)|(?<path-absolute>\/(?:(?<segment-nz>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])+)(?:\/\g<segment>)*)?)|(?<path-noscheme>(?<segment-nz-nc>(?:%\h\h|[!$&-.0-9;=@-Z_a-z~])+)(?:\/\g<segment>)*)|(?<path-empty>))(?:\?(?<query>[^#]*))?(?:\#(?<fragment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*))?)\z/
|
||||
attr_reader :regexp
|
||||
|
||||
def initialize
|
||||
@ -79,8 +78,14 @@ module Bundler::URI
|
||||
end
|
||||
|
||||
@@to_s = Kernel.instance_method(:to_s)
|
||||
def inspect
|
||||
@@to_s.bind_call(self)
|
||||
if @@to_s.respond_to?(:bind_call)
|
||||
def inspect
|
||||
@@to_s.bind_call(self)
|
||||
end
|
||||
else
|
||||
def inspect
|
||||
@@to_s.bind(self).call
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
2
lib/bundler/vendor/uri/lib/uri/version.rb
vendored
2
lib/bundler/vendor/uri/lib/uri/version.rb
vendored
@ -1,6 +1,6 @@
|
||||
module Bundler::URI
|
||||
# :stopdoc:
|
||||
VERSION_CODE = '001001'.freeze
|
||||
VERSION_CODE = '001200'.freeze
|
||||
VERSION = VERSION_CODE.scan(/../).collect{|n| n.to_i}.join('.').freeze
|
||||
# :startdoc:
|
||||
end
|
||||
|
3
lib/bundler/vendor/uri/lib/uri/ws.rb
vendored
3
lib/bundler/vendor/uri/lib/uri/ws.rb
vendored
@ -79,6 +79,5 @@ module Bundler::URI
|
||||
end
|
||||
end
|
||||
|
||||
@@schemes['WS'] = WS
|
||||
|
||||
register_scheme 'WS', WS
|
||||
end
|
||||
|
3
lib/bundler/vendor/uri/lib/uri/wss.rb
vendored
3
lib/bundler/vendor/uri/lib/uri/wss.rb
vendored
@ -18,5 +18,6 @@ module Bundler::URI
|
||||
# A Default port of 443 for Bundler::URI::WSS
|
||||
DEFAULT_PORT = 443
|
||||
end
|
||||
@@schemes['WSS'] = WSS
|
||||
|
||||
register_scheme 'WSS', WSS
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user