uri 1.0.4 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rdoc_options +1 -0
- data/lib/uri/common.rb +57 -15
- data/lib/uri/file.rb +1 -1
- data/lib/uri/generic.rb +13 -13
- data/lib/uri/http.rb +12 -0
- data/lib/uri/mailto.rb +5 -1
- data/lib/uri/rfc2396_parser.rb +9 -8
- data/lib/uri/version.rb +2 -2
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: d722ba02149add1e89ff05e9d244d6eaa52545455870b90acabbd69248817384
         | 
| 4 | 
            +
              data.tar.gz: 28dcbbf85d8c2b09a9840d0ef08e2f566d7d9a9c71bf293a597c7eb8fb4f3ba0
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: eaf90afcb2a7f8cad8e29322ac42d0e01f514a3ee8aed55494b8d7ba94757ff7415a0851f7192beed1025207cc974565e3a0ea8b0fafccf3ae49cccd0ee48f9e
         | 
| 7 | 
            +
              data.tar.gz: 03e1149499988dadd16cdd5757dc418ac8a937901858ad06f4740db08ac4b3bf267f7a33cb72c3af8cc5193c7354876ee63b2e6df64c262d928b5db8f7d3fd96
         | 
    
        data/.rdoc_options
    CHANGED
    
    
    
        data/lib/uri/common.rb
    CHANGED
    
    | @@ -30,6 +30,9 @@ module URI | |
| 30 30 | 
             
                remove_const(:Parser) if defined?(::URI::Parser)
         | 
| 31 31 | 
             
                const_set("Parser", parser.class)
         | 
| 32 32 |  | 
| 33 | 
            +
                remove_const(:PARSER) if defined?(::URI::PARSER)
         | 
| 34 | 
            +
                const_set("PARSER", parser)
         | 
| 35 | 
            +
             | 
| 33 36 | 
             
                remove_const(:REGEXP) if defined?(::URI::REGEXP)
         | 
| 34 37 | 
             
                remove_const(:PATTERN) if defined?(::URI::PATTERN)
         | 
| 35 38 | 
             
                if Parser == RFC2396_Parser
         | 
| @@ -49,10 +52,10 @@ module URI | |
| 49 52 | 
             
                  warn "URI::REGEXP is obsolete. Use URI::RFC2396_REGEXP explicitly.", uplevel: 1 if $VERBOSE
         | 
| 50 53 | 
             
                  URI::RFC2396_REGEXP
         | 
| 51 54 | 
             
                elsif value = RFC2396_PARSER.regexp[const]
         | 
| 52 | 
            -
                  warn "URI::#{const} is obsolete. Use RFC2396_PARSER.regexp[#{const.inspect}] explicitly.", uplevel: 1 if $VERBOSE
         | 
| 55 | 
            +
                  warn "URI::#{const} is obsolete. Use URI::RFC2396_PARSER.regexp[#{const.inspect}] explicitly.", uplevel: 1 if $VERBOSE
         | 
| 53 56 | 
             
                  value
         | 
| 54 57 | 
             
                elsif value = RFC2396_Parser.const_get(const)
         | 
| 55 | 
            -
                  warn "URI::#{const} is obsolete. Use RFC2396_Parser::#{const} explicitly.", uplevel: 1 if $VERBOSE
         | 
| 58 | 
            +
                  warn "URI::#{const} is obsolete. Use URI::RFC2396_Parser::#{const} explicitly.", uplevel: 1 if $VERBOSE
         | 
| 56 59 | 
             
                  value
         | 
| 57 60 | 
             
                else
         | 
| 58 61 | 
             
                  super
         | 
| @@ -92,6 +95,40 @@ module URI | |
| 92 95 | 
             
              end
         | 
| 93 96 |  | 
| 94 97 | 
             
              module Schemes # :nodoc:
         | 
| 98 | 
            +
                class << self
         | 
| 99 | 
            +
                  ReservedChars = ".+-"
         | 
| 100 | 
            +
                  EscapedChars = "\u01C0\u01C1\u01C2"
         | 
| 101 | 
            +
                  # Use Lo category chars as escaped chars for TruffleRuby, which
         | 
| 102 | 
            +
                  # does not allow Symbol categories as identifiers.
         | 
| 103 | 
            +
             | 
| 104 | 
            +
                  def escape(name)
         | 
| 105 | 
            +
                    unless name and name.ascii_only?
         | 
| 106 | 
            +
                      return nil
         | 
| 107 | 
            +
                    end
         | 
| 108 | 
            +
                    name.upcase.tr(ReservedChars, EscapedChars)
         | 
| 109 | 
            +
                  end
         | 
| 110 | 
            +
             | 
| 111 | 
            +
                  def unescape(name)
         | 
| 112 | 
            +
                    name.tr(EscapedChars, ReservedChars).encode(Encoding::US_ASCII).upcase
         | 
| 113 | 
            +
                  end
         | 
| 114 | 
            +
             | 
| 115 | 
            +
                  def find(name)
         | 
| 116 | 
            +
                    const_get(name, false) if name and const_defined?(name, false)
         | 
| 117 | 
            +
                  end
         | 
| 118 | 
            +
             | 
| 119 | 
            +
                  def register(name, klass)
         | 
| 120 | 
            +
                    unless scheme = escape(name)
         | 
| 121 | 
            +
                      raise ArgumentError, "invalid character as scheme - #{name}"
         | 
| 122 | 
            +
                    end
         | 
| 123 | 
            +
                    const_set(scheme, klass)
         | 
| 124 | 
            +
                  end
         | 
| 125 | 
            +
             | 
| 126 | 
            +
                  def list
         | 
| 127 | 
            +
                    constants.map { |name|
         | 
| 128 | 
            +
                      [unescape(name.to_s), const_get(name)]
         | 
| 129 | 
            +
                    }.to_h
         | 
| 130 | 
            +
                  end
         | 
| 131 | 
            +
                end
         | 
| 95 132 | 
             
              end
         | 
| 96 133 | 
             
              private_constant :Schemes
         | 
| 97 134 |  | 
| @@ -104,7 +141,7 @@ module URI | |
| 104 141 | 
             
              # Note that after calling String#upcase on +scheme+, it must be a valid
         | 
| 105 142 | 
             
              # constant name.
         | 
| 106 143 | 
             
              def self.register_scheme(scheme, klass)
         | 
| 107 | 
            -
                Schemes. | 
| 144 | 
            +
                Schemes.register(scheme, klass)
         | 
| 108 145 | 
             
              end
         | 
| 109 146 |  | 
| 110 147 | 
             
              # Returns a hash of the defined schemes:
         | 
| @@ -122,14 +159,14 @@ module URI | |
| 122 159 | 
             
              #
         | 
| 123 160 | 
             
              # Related: URI.register_scheme.
         | 
| 124 161 | 
             
              def self.scheme_list
         | 
| 125 | 
            -
                Schemes. | 
| 126 | 
            -
                  [name.to_s.upcase, Schemes.const_get(name)]
         | 
| 127 | 
            -
                }.to_h
         | 
| 162 | 
            +
                Schemes.list
         | 
| 128 163 | 
             
              end
         | 
| 129 164 |  | 
| 165 | 
            +
              # :stopdoc:
         | 
| 130 166 | 
             
              INITIAL_SCHEMES = scheme_list
         | 
| 131 167 | 
             
              private_constant :INITIAL_SCHEMES
         | 
| 132 168 | 
             
              Ractor.make_shareable(INITIAL_SCHEMES) if defined?(Ractor)
         | 
| 169 | 
            +
              # :startdoc:
         | 
| 133 170 |  | 
| 134 171 | 
             
              # Returns a new object constructed from the given +scheme+, +arguments+,
         | 
| 135 172 | 
             
              # and +default+:
         | 
| @@ -148,12 +185,10 @@ module URI | |
| 148 185 | 
             
              #   # => #<URI::HTTP foo://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top>
         | 
| 149 186 | 
             
              #
         | 
| 150 187 | 
             
              def self.for(scheme, *arguments, default: Generic)
         | 
| 151 | 
            -
                const_name = scheme | 
| 188 | 
            +
                const_name = Schemes.escape(scheme)
         | 
| 152 189 |  | 
| 153 190 | 
             
                uri_class = INITIAL_SCHEMES[const_name]
         | 
| 154 | 
            -
                uri_class ||=  | 
| 155 | 
            -
                  Schemes.const_get(const_name, false)
         | 
| 156 | 
            -
                end
         | 
| 191 | 
            +
                uri_class ||= Schemes.find(const_name)
         | 
| 157 192 | 
             
                uri_class ||= default
         | 
| 158 193 |  | 
| 159 194 | 
             
                return uri_class.new(scheme, *arguments)
         | 
| @@ -195,7 +230,7 @@ module URI | |
| 195 230 | 
             
              #    ["fragment", "top"]]
         | 
| 196 231 | 
             
              #
         | 
| 197 232 | 
             
              def self.split(uri)
         | 
| 198 | 
            -
                 | 
| 233 | 
            +
                PARSER.split(uri)
         | 
| 199 234 | 
             
              end
         | 
| 200 235 |  | 
| 201 236 | 
             
              # Returns a new \URI object constructed from the given string +uri+:
         | 
| @@ -205,11 +240,11 @@ module URI | |
| 205 240 | 
             
              #   URI.parse('http://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top')
         | 
| 206 241 | 
             
              #   # => #<URI::HTTP http://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top>
         | 
| 207 242 | 
             
              #
         | 
| 208 | 
            -
              # It's recommended to first ::escape string +uri+
         | 
| 243 | 
            +
              # It's recommended to first URI::RFC2396_PARSER.escape string +uri+
         | 
| 209 244 | 
             
              # if it may contain invalid URI characters.
         | 
| 210 245 | 
             
              #
         | 
| 211 246 | 
             
              def self.parse(uri)
         | 
| 212 | 
            -
                 | 
| 247 | 
            +
                PARSER.parse(uri)
         | 
| 213 248 | 
             
              end
         | 
| 214 249 |  | 
| 215 250 | 
             
              # Merges the given URI strings +str+
         | 
| @@ -265,7 +300,7 @@ module URI | |
| 265 300 | 
             
              #
         | 
| 266 301 | 
             
              def self.extract(str, schemes = nil, &block) # :nodoc:
         | 
| 267 302 | 
             
                warn "URI.extract is obsolete", uplevel: 1 if $VERBOSE
         | 
| 268 | 
            -
                 | 
| 303 | 
            +
                PARSER.extract(str, schemes, &block)
         | 
| 269 304 | 
             
              end
         | 
| 270 305 |  | 
| 271 306 | 
             
              #
         | 
| @@ -302,7 +337,7 @@ module URI | |
| 302 337 | 
             
              #
         | 
| 303 338 | 
             
              def self.regexp(schemes = nil)# :nodoc:
         | 
| 304 339 | 
             
                warn "URI.regexp is obsolete", uplevel: 1 if $VERBOSE
         | 
| 305 | 
            -
                 | 
| 340 | 
            +
                PARSER.make_regexp(schemes)
         | 
| 306 341 | 
             
              end
         | 
| 307 342 |  | 
| 308 343 | 
             
              TBLENCWWWCOMP_ = {} # :nodoc:
         | 
| @@ -407,6 +442,8 @@ module URI | |
| 407 442 | 
             
                _decode_uri_component(/%\h\h/, str, enc)
         | 
| 408 443 | 
             
              end
         | 
| 409 444 |  | 
| 445 | 
            +
              # Returns a string derived from the given string +str+ with
         | 
| 446 | 
            +
              # URI-encoded characters matching +regexp+ according to +table+.
         | 
| 410 447 | 
             
              def self._encode_uri_component(regexp, table, str, enc)
         | 
| 411 448 | 
             
                str = str.to_s.dup
         | 
| 412 449 | 
             
                if str.encoding != Encoding::ASCII_8BIT
         | 
| @@ -421,6 +458,8 @@ module URI | |
| 421 458 | 
             
              end
         | 
| 422 459 | 
             
              private_class_method :_encode_uri_component
         | 
| 423 460 |  | 
| 461 | 
            +
              # Returns a string decoding characters matching +regexp+ from the
         | 
| 462 | 
            +
              # given \URL-encoded string +str+.
         | 
| 424 463 | 
             
              def self._decode_uri_component(regexp, str, enc)
         | 
| 425 464 | 
             
                raise ArgumentError, "invalid %-encoding (#{str})" if /%(?!\h\h)/.match?(str)
         | 
| 426 465 | 
             
                str.b.gsub(regexp, TBLDECWWWCOMP_).force_encoding(enc)
         | 
| @@ -859,6 +898,7 @@ module Kernel | |
| 859 898 | 
             
              # Returns a \URI object derived from the given +uri+,
         | 
| 860 899 | 
             
              # which may be a \URI string or an existing \URI object:
         | 
| 861 900 | 
             
              #
         | 
| 901 | 
            +
              #   require 'uri'
         | 
| 862 902 | 
             
              #   # Returns a new URI.
         | 
| 863 903 | 
             
              #   uri = URI('http://github.com/ruby/ruby')
         | 
| 864 904 | 
             
              #   # => #<URI::HTTP http://github.com/ruby/ruby>
         | 
| @@ -866,6 +906,8 @@ module Kernel | |
| 866 906 | 
             
              #   URI(uri)
         | 
| 867 907 | 
             
              #   # => #<URI::HTTP http://github.com/ruby/ruby>
         | 
| 868 908 | 
             
              #
         | 
| 909 | 
            +
              # You must require 'uri' to use this method.
         | 
| 910 | 
            +
              #
         | 
| 869 911 | 
             
              def URI(uri)
         | 
| 870 912 | 
             
                if uri.is_a?(URI::Generic)
         | 
| 871 913 | 
             
                  uri
         | 
    
        data/lib/uri/file.rb
    CHANGED
    
    | @@ -47,7 +47,7 @@ module URI | |
| 47 47 | 
             
                #       :path => '/ruby/src'})
         | 
| 48 48 | 
             
                #     uri2.to_s  # => "file://host.example.com/ruby/src"
         | 
| 49 49 | 
             
                #
         | 
| 50 | 
            -
                #     uri3 = URI::File.build({:path => URI::escape('/path/my file.txt')})
         | 
| 50 | 
            +
                #     uri3 = URI::File.build({:path => URI::RFC2396_PARSER.escape('/path/my file.txt')})
         | 
| 51 51 | 
             
                #     uri3.to_s  # => "file:///path/my%20file.txt"
         | 
| 52 52 | 
             
                #
         | 
| 53 53 | 
             
                def self.build(args)
         | 
    
        data/lib/uri/generic.rb
    CHANGED
    
    | @@ -73,7 +73,7 @@ module URI | |
| 73 73 | 
             
                #
         | 
| 74 74 | 
             
                # At first, tries to create a new URI::Generic instance using
         | 
| 75 75 | 
             
                # URI::Generic::build. But, if exception URI::InvalidComponentError is raised,
         | 
| 76 | 
            -
                # then it does URI:: | 
| 76 | 
            +
                # then it does URI::RFC2396_PARSER.escape all URI components and tries again.
         | 
| 77 77 | 
             
                #
         | 
| 78 78 | 
             
                def self.build2(args)
         | 
| 79 79 | 
             
                  begin
         | 
| @@ -126,9 +126,9 @@ module URI | |
| 126 126 | 
             
                      end
         | 
| 127 127 | 
             
                    end
         | 
| 128 128 | 
             
                  else
         | 
| 129 | 
            -
                    component = self. | 
| 129 | 
            +
                    component = self.component rescue ::URI::Generic::COMPONENT
         | 
| 130 130 | 
             
                    raise ArgumentError,
         | 
| 131 | 
            -
             | 
| 131 | 
            +
                          "expected Array of or Hash of components of #{self} (#{component.join(', ')})"
         | 
| 132 132 | 
             
                  end
         | 
| 133 133 |  | 
| 134 134 | 
             
                  tmp << nil
         | 
| @@ -284,7 +284,7 @@ module URI | |
| 284 284 |  | 
| 285 285 | 
             
                # Returns the parser to be used.
         | 
| 286 286 | 
             
                #
         | 
| 287 | 
            -
                # Unless  | 
| 287 | 
            +
                # Unless the +parser+ is defined, DEFAULT_PARSER is used.
         | 
| 288 288 | 
             
                #
         | 
| 289 289 | 
             
                def parser
         | 
| 290 290 | 
             
                  if !defined?(@parser) || !@parser
         | 
| @@ -315,7 +315,7 @@ module URI | |
| 315 315 | 
             
                end
         | 
| 316 316 |  | 
| 317 317 | 
             
                #
         | 
| 318 | 
            -
                # Checks the scheme +v+ component against the  | 
| 318 | 
            +
                # Checks the scheme +v+ component against the +parser+ Regexp for :SCHEME.
         | 
| 319 319 | 
             
                #
         | 
| 320 320 | 
             
                def check_scheme(v)
         | 
| 321 321 | 
             
                  if v && parser.regexp[:SCHEME] !~ v
         | 
| @@ -385,7 +385,7 @@ module URI | |
| 385 385 |  | 
| 386 386 | 
             
                #
         | 
| 387 387 | 
             
                # Checks the user +v+ component for RFC2396 compliance
         | 
| 388 | 
            -
                # and against the  | 
| 388 | 
            +
                # and against the +parser+ Regexp for :USERINFO.
         | 
| 389 389 | 
             
                #
         | 
| 390 390 | 
             
                # Can not have a registry or opaque component defined,
         | 
| 391 391 | 
             
                # with a user component defined.
         | 
| @@ -409,7 +409,7 @@ module URI | |
| 409 409 |  | 
| 410 410 | 
             
                #
         | 
| 411 411 | 
             
                # Checks the password +v+ component for RFC2396 compliance
         | 
| 412 | 
            -
                # and against the  | 
| 412 | 
            +
                # and against the +parser+ Regexp for :USERINFO.
         | 
| 413 413 | 
             
                #
         | 
| 414 414 | 
             
                # Can not have a registry or opaque component defined,
         | 
| 415 415 | 
             
                # with a user component defined.
         | 
| @@ -592,7 +592,7 @@ module URI | |
| 592 592 |  | 
| 593 593 | 
             
                #
         | 
| 594 594 | 
             
                # Checks the host +v+ component for RFC2396 compliance
         | 
| 595 | 
            -
                # and against the  | 
| 595 | 
            +
                # and against the +parser+ Regexp for :HOST.
         | 
| 596 596 | 
             
                #
         | 
| 597 597 | 
             
                # Can not have a registry or opaque component defined,
         | 
| 598 598 | 
             
                # with a host component defined.
         | 
| @@ -689,7 +689,7 @@ module URI | |
| 689 689 |  | 
| 690 690 | 
             
                #
         | 
| 691 691 | 
             
                # Checks the port +v+ component for RFC2396 compliance
         | 
| 692 | 
            -
                # and against the  | 
| 692 | 
            +
                # and against the +parser+ Regexp for :PORT.
         | 
| 693 693 | 
             
                #
         | 
| 694 694 | 
             
                # Can not have a registry or opaque component defined,
         | 
| 695 695 | 
             
                # with a port component defined.
         | 
| @@ -763,7 +763,7 @@ module URI | |
| 763 763 |  | 
| 764 764 | 
             
                #
         | 
| 765 765 | 
             
                # Checks the path +v+ component for RFC2396 compliance
         | 
| 766 | 
            -
                # and against the  | 
| 766 | 
            +
                # and against the +parser+ Regexp
         | 
| 767 767 | 
             
                # for :ABS_PATH and :REL_PATH.
         | 
| 768 768 | 
             
                #
         | 
| 769 769 | 
             
                # Can not have a opaque component defined,
         | 
| @@ -868,7 +868,7 @@ module URI | |
| 868 868 |  | 
| 869 869 | 
             
                #
         | 
| 870 870 | 
             
                # Checks the opaque +v+ component for RFC2396 compliance and
         | 
| 871 | 
            -
                # against the  | 
| 871 | 
            +
                # against the +parser+ Regexp for :OPAQUE.
         | 
| 872 872 | 
             
                #
         | 
| 873 873 | 
             
                # Can not have a host, port, user, or path component defined,
         | 
| 874 874 | 
             
                # with an opaque component defined.
         | 
| @@ -920,7 +920,7 @@ module URI | |
| 920 920 | 
             
                end
         | 
| 921 921 |  | 
| 922 922 | 
             
                #
         | 
| 923 | 
            -
                # Checks the fragment +v+ component against the  | 
| 923 | 
            +
                # Checks the fragment +v+ component against the +parser+ Regexp for :FRAGMENT.
         | 
| 924 924 | 
             
                #
         | 
| 925 925 | 
             
                #
         | 
| 926 926 | 
             
                # == Args
         | 
| @@ -1540,7 +1540,7 @@ module URI | |
| 1540 1540 | 
             
                    else
         | 
| 1541 1541 | 
             
                      unless proxy_uri = env[name]
         | 
| 1542 1542 | 
             
                        if proxy_uri = env[name.upcase]
         | 
| 1543 | 
            -
                          warn 'The environment variable HTTP_PROXY is discouraged.   | 
| 1543 | 
            +
                          warn 'The environment variable HTTP_PROXY is discouraged.  Please use http_proxy instead.', uplevel: 1
         | 
| 1544 1544 | 
             
                        end
         | 
| 1545 1545 | 
             
                      end
         | 
| 1546 1546 | 
             
                    end
         | 
    
        data/lib/uri/http.rb
    CHANGED
    
    | @@ -61,6 +61,18 @@ module URI | |
| 61 61 | 
             
                  super(tmp)
         | 
| 62 62 | 
             
                end
         | 
| 63 63 |  | 
| 64 | 
            +
                # Do not allow empty host names, as they are not allowed by RFC 3986.
         | 
| 65 | 
            +
                def check_host(v)
         | 
| 66 | 
            +
                  ret = super
         | 
| 67 | 
            +
             | 
| 68 | 
            +
                  if ret && v.empty?
         | 
| 69 | 
            +
                    raise InvalidComponentError,
         | 
| 70 | 
            +
                      "bad component(expected host component): #{v}"
         | 
| 71 | 
            +
                  end
         | 
| 72 | 
            +
             | 
| 73 | 
            +
                  ret
         | 
| 74 | 
            +
                end
         | 
| 75 | 
            +
             | 
| 64 76 | 
             
                #
         | 
| 65 77 | 
             
                # == Description
         | 
| 66 78 | 
             
                #
         | 
    
        data/lib/uri/mailto.rb
    CHANGED
    
    | @@ -52,7 +52,11 @@ module URI | |
| 52 52 | 
             
                HEADER_REGEXP  = /\A(?<hfield>(?:%\h\h|[!$'-.0-;@-Z_a-z~])*=(?:%\h\h|[!$'-.0-;@-Z_a-z~])*)(?:&\g<hfield>)*\z/
         | 
| 53 53 | 
             
                # practical regexp for email address
         | 
| 54 54 | 
             
                # https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address
         | 
| 55 | 
            -
                EMAIL_REGEXP =  | 
| 55 | 
            +
                EMAIL_REGEXP = %r[\A#{
         | 
| 56 | 
            +
                  atext = %q[(?:[a-zA-Z0-9!\#$%&'*+\/=?^_`{|}~-]+)]
         | 
| 57 | 
            +
                }(?:\.#{atext})*@#{
         | 
| 58 | 
            +
                  label = %q[(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)]
         | 
| 59 | 
            +
                }(?:\.#{label})*\z]
         | 
| 56 60 | 
             
                # :startdoc:
         | 
| 57 61 |  | 
| 58 62 | 
             
                #
         | 
    
        data/lib/uri/rfc2396_parser.rb
    CHANGED
    
    | @@ -67,7 +67,7 @@ module URI | |
| 67 67 | 
             
                #
         | 
| 68 68 | 
             
                # == Synopsis
         | 
| 69 69 | 
             
                #
         | 
| 70 | 
            -
                #   URI:: | 
| 70 | 
            +
                #   URI::RFC2396_Parser.new([opts])
         | 
| 71 71 | 
             
                #
         | 
| 72 72 | 
             
                # == Args
         | 
| 73 73 | 
             
                #
         | 
| @@ -86,7 +86,7 @@ module URI | |
| 86 86 | 
             
                #
         | 
| 87 87 | 
             
                # == Examples
         | 
| 88 88 | 
             
                #
         | 
| 89 | 
            -
                #   p = URI:: | 
| 89 | 
            +
                #   p = URI::RFC2396_Parser.new(:ESCAPED => "(?:%[a-fA-F0-9]{2}|%u[a-fA-F0-9]{4})")
         | 
| 90 90 | 
             
                #   u = p.parse("http://example.jp/%uABCD") #=> #<URI::HTTP http://example.jp/%uABCD>
         | 
| 91 91 | 
             
                #   URI.parse(u.to_s) #=> raises URI::InvalidURIError
         | 
| 92 92 | 
             
                #
         | 
| @@ -108,12 +108,12 @@ module URI | |
| 108 108 |  | 
| 109 109 | 
             
                # The Hash of patterns.
         | 
| 110 110 | 
             
                #
         | 
| 111 | 
            -
                # See also  | 
| 111 | 
            +
                # See also #initialize_pattern.
         | 
| 112 112 | 
             
                attr_reader :pattern
         | 
| 113 113 |  | 
| 114 114 | 
             
                # The Hash of Regexp.
         | 
| 115 115 | 
             
                #
         | 
| 116 | 
            -
                # See also  | 
| 116 | 
            +
                # See also #initialize_regexp.
         | 
| 117 117 | 
             
                attr_reader :regexp
         | 
| 118 118 |  | 
| 119 119 | 
             
                # Returns a split URI against +regexp[:ABS_URI]+.
         | 
| @@ -202,8 +202,7 @@ module URI | |
| 202 202 | 
             
                #
         | 
| 203 203 | 
             
                # == Usage
         | 
| 204 204 | 
             
                #
         | 
| 205 | 
            -
                #    | 
| 206 | 
            -
                #   p.parse("ldap://ldap.example.com/dc=example?user=john")
         | 
| 205 | 
            +
                #   URI::RFC2396_PARSER.parse("ldap://ldap.example.com/dc=example?user=john")
         | 
| 207 206 | 
             
                #   #=> #<URI::LDAP ldap://ldap.example.com/dc=example?user=john>
         | 
| 208 207 | 
             
                #
         | 
| 209 208 | 
             
                def parse(uri)
         | 
| @@ -244,7 +243,7 @@ module URI | |
| 244 243 | 
             
                # If no +block+ given, then returns the result,
         | 
| 245 244 | 
             
                # else it calls +block+ for each element in result.
         | 
| 246 245 | 
             
                #
         | 
| 247 | 
            -
                # See also  | 
| 246 | 
            +
                # See also #make_regexp.
         | 
| 248 247 | 
             
                #
         | 
| 249 248 | 
             
                def extract(str, schemes = nil)
         | 
| 250 249 | 
             
                  if block_given?
         | 
| @@ -263,7 +262,7 @@ module URI | |
| 263 262 | 
             
                  unless schemes
         | 
| 264 263 | 
             
                    @regexp[:ABS_URI_REF]
         | 
| 265 264 | 
             
                  else
         | 
| 266 | 
            -
                    /( | 
| 265 | 
            +
                    /(?=(?i:#{Regexp.union(*schemes).source}):)#{@pattern[:X_ABS_URI]}/x
         | 
| 267 266 | 
             
                  end
         | 
| 268 267 | 
             
                end
         | 
| 269 268 |  | 
| @@ -524,6 +523,8 @@ module URI | |
| 524 523 | 
             
                  ret
         | 
| 525 524 | 
             
                end
         | 
| 526 525 |  | 
| 526 | 
            +
                # Returns +uri+ as-is if it is URI, or convert it to URI if it is
         | 
| 527 | 
            +
                # a String.
         | 
| 527 528 | 
             
                def convert_to_uri(uri)
         | 
| 528 529 | 
             
                  if uri.is_a?(URI::Generic)
         | 
| 529 530 | 
             
                    uri
         | 
    
        data/lib/uri/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: uri
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.0 | 
| 4 | 
            +
              version: 1.1.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Akira Yamada
         | 
| @@ -61,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 61 61 | 
             
                - !ruby/object:Gem::Version
         | 
| 62 62 | 
             
                  version: '0'
         | 
| 63 63 | 
             
            requirements: []
         | 
| 64 | 
            -
            rubygems_version: 3. | 
| 64 | 
            +
            rubygems_version: 3.6.9
         | 
| 65 65 | 
             
            specification_version: 4
         | 
| 66 66 | 
             
            summary: URI is a module providing classes to handle Uniform Resource Identifiers
         | 
| 67 67 | 
             
            test_files: []
         |