uri 0.10.0.3 → 0.10.1
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.
Potentially problematic release.
This version of uri might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +24 -0
- data/Gemfile +0 -1
- data/README.md +1 -1
- data/Rakefile +2 -9
- data/lib/uri/common.rb +17 -80
- data/lib/uri/ftp.rb +0 -1
- data/lib/uri/generic.rb +5 -6
- data/lib/uri/http.rb +0 -1
- data/lib/uri/https.rb +0 -1
- data/lib/uri/ldap.rb +0 -1
- data/lib/uri/mailto.rb +0 -1
- data/lib/uri/rfc2396_parser.rb +3 -16
- data/lib/uri/rfc3986_parser.rb +4 -15
- data/lib/uri/version.rb +1 -1
- data/lib/uri/ws.rb +84 -0
- data/lib/uri/wss.rb +22 -0
- data/lib/uri.rb +10 -11
- data/uri.gemspec +1 -1
- metadata +7 -4
- data/.travis.yml +0 -7
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 90cdca72e248dc3cf6df707f34d7dcab07af72dbf959f4aca94366d60c5957a9
         | 
| 4 | 
            +
              data.tar.gz: 5780324f560819375f5bf77aa64dd1e26306962906af94579ee121a8d0f3e897
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 525bd1d9e6626e0b16012072113c83c5e1c53feef99f10c3731683fb1ce52c23070eedcdc250b9998073a49fdcf3a78ad4ab96339e743c12a283c873323e2789
         | 
| 7 | 
            +
              data.tar.gz: f2a660568adaf11db79134d2cbe82fc2c06067f91577413c92acd11a985bcdaed0016d8d76fe299890f221a86b8e7ef15c7a87d0eb210e428ffc4fd53c172a73
         | 
| @@ -0,0 +1,24 @@ | |
| 1 | 
            +
            name: ubuntu
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            on: [push, pull_request]
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            jobs:
         | 
| 6 | 
            +
              build:
         | 
| 7 | 
            +
                name: build (${{ matrix.ruby }} / ${{ matrix.os }})
         | 
| 8 | 
            +
                strategy:
         | 
| 9 | 
            +
                  matrix:
         | 
| 10 | 
            +
                    ruby: [ 2.7, 2.6, 2.5, 2.4, head ]
         | 
| 11 | 
            +
                    os: [ ubuntu-latest, macos-latest ]
         | 
| 12 | 
            +
                runs-on: ${{ matrix.os }}
         | 
| 13 | 
            +
                steps:
         | 
| 14 | 
            +
                - uses: actions/checkout@master
         | 
| 15 | 
            +
                - name: Set up Ruby
         | 
| 16 | 
            +
                  uses: ruby/setup-ruby@v1
         | 
| 17 | 
            +
                  with:
         | 
| 18 | 
            +
                    ruby-version: ${{ matrix.ruby }}
         | 
| 19 | 
            +
                - name: Install dependencies
         | 
| 20 | 
            +
                  run: |
         | 
| 21 | 
            +
                    gem install bundler --no-document
         | 
| 22 | 
            +
                    bundle install
         | 
| 23 | 
            +
                - name: Run test
         | 
| 24 | 
            +
                  run: rake test
         | 
    
        data/Gemfile
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -50,4 +50,4 @@ To install this gem onto your local machine, run `bundle exec rake install`. To | |
| 50 50 |  | 
| 51 51 | 
             
            ## Contributing
         | 
| 52 52 |  | 
| 53 | 
            -
            Bug reports and pull requests are welcome on GitHub at https://github.com/ | 
| 53 | 
            +
            Bug reports and pull requests are welcome on GitHub at https://github.com/ruby/uri.
         | 
    
        data/Rakefile
    CHANGED
    
    | @@ -2,16 +2,9 @@ require "bundler/gem_tasks" | |
| 2 2 | 
             
            require "rake/testtask"
         | 
| 3 3 |  | 
| 4 4 | 
             
            Rake::TestTask.new(:test) do |t|
         | 
| 5 | 
            -
              t.libs << "test/lib"
         | 
| 6 | 
            -
              t. | 
| 5 | 
            +
              t.libs << "test" << "test/lib"
         | 
| 6 | 
            +
              t.libs << "lib"
         | 
| 7 7 | 
             
              t.test_files = FileList["test/**/test_*.rb"]
         | 
| 8 8 | 
             
            end
         | 
| 9 9 |  | 
| 10 | 
            -
            task :sync_tool do
         | 
| 11 | 
            -
              require 'fileutils'
         | 
| 12 | 
            -
              FileUtils.cp "../ruby/tool/lib/test/unit/core_assertions.rb", "./test/lib"
         | 
| 13 | 
            -
              FileUtils.cp "../ruby/tool/lib/envutil.rb", "./test/lib"
         | 
| 14 | 
            -
              FileUtils.cp "../ruby/tool/lib/find_executable.rb", "./test/lib"
         | 
| 15 | 
            -
            end
         | 
| 16 | 
            -
             | 
| 17 10 | 
             
            task :default => :test
         | 
    
        data/lib/uri/common.rb
    CHANGED
    
    | @@ -3,7 +3,6 @@ | |
| 3 3 | 
             
            # = uri/common.rb
         | 
| 4 4 | 
             
            #
         | 
| 5 5 | 
             
            # Author:: Akira Yamada <akira@ruby-lang.org>
         | 
| 6 | 
            -
            # Revision:: $Id$
         | 
| 7 6 | 
             
            # License::
         | 
| 8 7 | 
             
            #   You can redistribute it and/or modify it under the same term as Ruby.
         | 
| 9 8 | 
             
            #
         | 
| @@ -61,82 +60,6 @@ module URI | |
| 61 60 | 
             
                module_function :make_components_hash
         | 
| 62 61 | 
             
              end
         | 
| 63 62 |  | 
| 64 | 
            -
              # Module for escaping unsafe characters with codes.
         | 
| 65 | 
            -
              module Escape
         | 
| 66 | 
            -
                #
         | 
| 67 | 
            -
                # == Synopsis
         | 
| 68 | 
            -
                #
         | 
| 69 | 
            -
                #   URI.escape(str [, unsafe])
         | 
| 70 | 
            -
                #
         | 
| 71 | 
            -
                # == Args
         | 
| 72 | 
            -
                #
         | 
| 73 | 
            -
                # +str+::
         | 
| 74 | 
            -
                #   String to replaces in.
         | 
| 75 | 
            -
                # +unsafe+::
         | 
| 76 | 
            -
                #   Regexp that matches all symbols that must be replaced with codes.
         | 
| 77 | 
            -
                #   By default uses <tt>UNSAFE</tt>.
         | 
| 78 | 
            -
                #   When this argument is a String, it represents a character set.
         | 
| 79 | 
            -
                #
         | 
| 80 | 
            -
                # == Description
         | 
| 81 | 
            -
                #
         | 
| 82 | 
            -
                # Escapes the string, replacing all unsafe characters with codes.
         | 
| 83 | 
            -
                #
         | 
| 84 | 
            -
                # This method is obsolete and should not be used. Instead, use
         | 
| 85 | 
            -
                # CGI.escape, URI.encode_www_form or URI.encode_www_form_component
         | 
| 86 | 
            -
                # depending on your specific use case.
         | 
| 87 | 
            -
                #
         | 
| 88 | 
            -
                # == Usage
         | 
| 89 | 
            -
                #
         | 
| 90 | 
            -
                #   require 'uri'
         | 
| 91 | 
            -
                #
         | 
| 92 | 
            -
                #   enc_uri = URI.escape("http://example.com/?a=\11\15")
         | 
| 93 | 
            -
                #   # => "http://example.com/?a=%09%0D"
         | 
| 94 | 
            -
                #
         | 
| 95 | 
            -
                #   URI.unescape(enc_uri)
         | 
| 96 | 
            -
                #   # => "http://example.com/?a=\t\r"
         | 
| 97 | 
            -
                #
         | 
| 98 | 
            -
                #   URI.escape("@?@!", "!?")
         | 
| 99 | 
            -
                #   # => "@%3F@%21"
         | 
| 100 | 
            -
                #
         | 
| 101 | 
            -
                def escape(*arg)
         | 
| 102 | 
            -
                  warn "URI.escape is obsolete", uplevel: 1
         | 
| 103 | 
            -
                  DEFAULT_PARSER.escape(*arg)
         | 
| 104 | 
            -
                end
         | 
| 105 | 
            -
                alias encode escape
         | 
| 106 | 
            -
                #
         | 
| 107 | 
            -
                # == Synopsis
         | 
| 108 | 
            -
                #
         | 
| 109 | 
            -
                #   URI.unescape(str)
         | 
| 110 | 
            -
                #
         | 
| 111 | 
            -
                # == Args
         | 
| 112 | 
            -
                #
         | 
| 113 | 
            -
                # +str+::
         | 
| 114 | 
            -
                #   String to unescape.
         | 
| 115 | 
            -
                #
         | 
| 116 | 
            -
                # == Description
         | 
| 117 | 
            -
                #
         | 
| 118 | 
            -
                # This method is obsolete and should not be used. Instead, use
         | 
| 119 | 
            -
                # CGI.unescape, URI.decode_www_form or URI.decode_www_form_component
         | 
| 120 | 
            -
                # depending on your specific use case.
         | 
| 121 | 
            -
                #
         | 
| 122 | 
            -
                # == Usage
         | 
| 123 | 
            -
                #
         | 
| 124 | 
            -
                #   require 'uri'
         | 
| 125 | 
            -
                #
         | 
| 126 | 
            -
                #   enc_uri = URI.escape("http://example.com/?a=\11\15")
         | 
| 127 | 
            -
                #   # => "http://example.com/?a=%09%0D"
         | 
| 128 | 
            -
                #
         | 
| 129 | 
            -
                #   URI.unescape(enc_uri)
         | 
| 130 | 
            -
                #   # => "http://example.com/?a=\t\r"
         | 
| 131 | 
            -
                #
         | 
| 132 | 
            -
                def unescape(*arg)
         | 
| 133 | 
            -
                  warn "URI.unescape is obsolete", uplevel: 1
         | 
| 134 | 
            -
                  DEFAULT_PARSER.unescape(*arg)
         | 
| 135 | 
            -
                end
         | 
| 136 | 
            -
                alias decode unescape
         | 
| 137 | 
            -
              end # module Escape
         | 
| 138 | 
            -
             | 
| 139 | 
            -
              extend Escape
         | 
| 140 63 | 
             
              include REGEXP
         | 
| 141 64 |  | 
| 142 65 | 
             
              @@schemes = {}
         | 
| @@ -145,6 +68,20 @@ module URI | |
| 145 68 | 
             
                @@schemes
         | 
| 146 69 | 
             
              end
         | 
| 147 70 |  | 
| 71 | 
            +
              #
         | 
| 72 | 
            +
              # Construct a URI instance, using the scheme to detect the appropriate class
         | 
| 73 | 
            +
              # from +URI.scheme_list+.
         | 
| 74 | 
            +
              #
         | 
| 75 | 
            +
              def self.for(scheme, *arguments, default: Generic)
         | 
| 76 | 
            +
                if scheme
         | 
| 77 | 
            +
                  uri_class = @@schemes[scheme.upcase] || default
         | 
| 78 | 
            +
                else
         | 
| 79 | 
            +
                  uri_class = default
         | 
| 80 | 
            +
                end
         | 
| 81 | 
            +
             | 
| 82 | 
            +
                return uri_class.new(scheme, *arguments)
         | 
| 83 | 
            +
              end
         | 
| 84 | 
            +
             | 
| 148 85 | 
             
              #
         | 
| 149 86 | 
             
              # Base class for all URI exceptions.
         | 
| 150 87 | 
             
              #
         | 
| @@ -315,7 +252,7 @@ module URI | |
| 315 252 | 
             
              #
         | 
| 316 253 | 
             
              # Returns a Regexp object which matches to URI-like strings.
         | 
| 317 254 | 
             
              # The Regexp object returned by this method includes arbitrary
         | 
| 318 | 
            -
              # number of capture group (parentheses).  Never rely on  | 
| 255 | 
            +
              # number of capture group (parentheses).  Never rely on its number.
         | 
| 319 256 | 
             
              #
         | 
| 320 257 | 
             
              # == Usage
         | 
| 321 258 | 
             
              #
         | 
| @@ -362,7 +299,7 @@ module URI | |
| 362 299 | 
             
              # If +enc+ is given, convert +str+ to the encoding before percent encoding.
         | 
| 363 300 | 
             
              #
         | 
| 364 301 | 
             
              # This is an implementation of
         | 
| 365 | 
            -
              #  | 
| 302 | 
            +
              # https://www.w3.org/TR/2013/CR-html5-20130806/forms.html#url-encoded-form-data.
         | 
| 366 303 | 
             
              #
         | 
| 367 304 | 
             
              # See URI.decode_www_form_component, URI.encode_www_form.
         | 
| 368 305 | 
             
              def self.encode_www_form_component(str, enc=nil)
         | 
| @@ -403,7 +340,7 @@ module URI | |
| 403 340 | 
             
              # This method doesn't handle files.  When you send a file, use
         | 
| 404 341 | 
             
              # multipart/form-data.
         | 
| 405 342 | 
             
              #
         | 
| 406 | 
            -
              # This refers  | 
| 343 | 
            +
              # This refers https://url.spec.whatwg.org/#concept-urlencoded-serializer
         | 
| 407 344 | 
             
              #
         | 
| 408 345 | 
             
              #    URI.encode_www_form([["q", "ruby"], ["lang", "en"]])
         | 
| 409 346 | 
             
              #    #=> "q=ruby&lang=en"
         | 
    
        data/lib/uri/ftp.rb
    CHANGED
    
    
    
        data/lib/uri/generic.rb
    CHANGED
    
    | @@ -4,7 +4,6 @@ | |
| 4 4 | 
             
            #
         | 
| 5 5 | 
             
            # Author:: Akira Yamada <akira@ruby-lang.org>
         | 
| 6 6 | 
             
            # License:: You can redistribute it and/or modify it under the same term as Ruby.
         | 
| 7 | 
            -
            # Revision:: $Id$
         | 
| 8 7 | 
             
            #
         | 
| 9 8 | 
             
            # See URI for general documentation
         | 
| 10 9 | 
             
            #
         | 
| @@ -1098,7 +1097,7 @@ module URI | |
| 1098 1097 | 
             
                #   # => "http://my.example.com/main.rbx?page=1"
         | 
| 1099 1098 | 
             
                #
         | 
| 1100 1099 | 
             
                def merge(oth)
         | 
| 1101 | 
            -
                  rel = parser. | 
| 1100 | 
            +
                  rel = parser.__send__(:convert_to_uri, oth)
         | 
| 1102 1101 |  | 
| 1103 1102 | 
             
                  if rel.absolute?
         | 
| 1104 1103 | 
             
                    #raise BadURIError, "both URI are absolute" if absolute?
         | 
| @@ -1183,7 +1182,7 @@ module URI | |
| 1183 1182 |  | 
| 1184 1183 | 
             
                # :stopdoc:
         | 
| 1185 1184 | 
             
                def route_from0(oth)
         | 
| 1186 | 
            -
                  oth = parser. | 
| 1185 | 
            +
                  oth = parser.__send__(:convert_to_uri, oth)
         | 
| 1187 1186 | 
             
                  if self.relative?
         | 
| 1188 1187 | 
             
                    raise BadURIError,
         | 
| 1189 1188 | 
             
                      "relative URI: #{self}"
         | 
| @@ -1291,7 +1290,7 @@ module URI | |
| 1291 1290 | 
             
                #   #=> #<URI::Generic /main.rbx?page=1>
         | 
| 1292 1291 | 
             
                #
         | 
| 1293 1292 | 
             
                def route_to(oth)
         | 
| 1294 | 
            -
                  parser. | 
| 1293 | 
            +
                  parser.__send__(:convert_to_uri, oth).route_from(self)
         | 
| 1295 1294 | 
             
                end
         | 
| 1296 1295 |  | 
| 1297 1296 | 
             
                #
         | 
| @@ -1405,7 +1404,7 @@ module URI | |
| 1405 1404 | 
             
                # Returns an Array of the components defined from the COMPONENT Array.
         | 
| 1406 1405 | 
             
                def component_ary
         | 
| 1407 1406 | 
             
                  component.collect do |x|
         | 
| 1408 | 
            -
                    self. | 
| 1407 | 
            +
                    self.__send__(x)
         | 
| 1409 1408 | 
             
                  end
         | 
| 1410 1409 | 
             
                end
         | 
| 1411 1410 | 
             
                protected :component_ary
         | 
| @@ -1430,7 +1429,7 @@ module URI | |
| 1430 1429 | 
             
                def select(*components)
         | 
| 1431 1430 | 
             
                  components.collect do |c|
         | 
| 1432 1431 | 
             
                    if component.include?(c)
         | 
| 1433 | 
            -
                      self. | 
| 1432 | 
            +
                      self.__send__(c)
         | 
| 1434 1433 | 
             
                    else
         | 
| 1435 1434 | 
             
                      raise ArgumentError,
         | 
| 1436 1435 | 
             
                        "expected of components of #{self.class} (#{self.class.component.join(', ')})"
         | 
    
        data/lib/uri/http.rb
    CHANGED
    
    
    
        data/lib/uri/https.rb
    CHANGED
    
    
    
        data/lib/uri/ldap.rb
    CHANGED
    
    
    
        data/lib/uri/mailto.rb
    CHANGED
    
    
    
        data/lib/uri/rfc2396_parser.rb
    CHANGED
    
    | @@ -3,7 +3,6 @@ | |
| 3 3 | 
             
            # = uri/common.rb
         | 
| 4 4 | 
             
            #
         | 
| 5 5 | 
             
            # Author:: Akira Yamada <akira@ruby-lang.org>
         | 
| 6 | 
            -
            # Revision:: $Id$
         | 
| 7 6 | 
             
            # License::
         | 
| 8 7 | 
             
            #   You can redistribute it and/or modify it under the same term as Ruby.
         | 
| 9 8 | 
             
            #
         | 
| @@ -208,21 +207,9 @@ module URI | |
| 208 207 | 
             
                #   #=> #<URI::LDAP ldap://ldap.example.com/dc=example?user=john>
         | 
| 209 208 | 
             
                #
         | 
| 210 209 | 
             
                def parse(uri)
         | 
| 211 | 
            -
                   | 
| 212 | 
            -
                    registry, path, opaque, query, fragment = self.split(uri)
         | 
| 213 | 
            -
             | 
| 214 | 
            -
                  if scheme && URI.scheme_list.include?(scheme.upcase)
         | 
| 215 | 
            -
                    URI.scheme_list[scheme.upcase].new(scheme, userinfo, host, port,
         | 
| 216 | 
            -
                                                       registry, path, opaque, query,
         | 
| 217 | 
            -
                                                       fragment, self)
         | 
| 218 | 
            -
                  else
         | 
| 219 | 
            -
                    Generic.new(scheme, userinfo, host, port,
         | 
| 220 | 
            -
                                registry, path, opaque, query,
         | 
| 221 | 
            -
                                fragment, self)
         | 
| 222 | 
            -
                  end
         | 
| 210 | 
            +
                  URI.for(*self.split(uri), self)
         | 
| 223 211 | 
             
                end
         | 
| 224 212 |  | 
| 225 | 
            -
             | 
| 226 213 | 
             
                #
         | 
| 227 214 | 
             
                # == Args
         | 
| 228 215 | 
             
                #
         | 
| @@ -504,8 +491,8 @@ module URI | |
| 504 491 | 
             
                  ret = {}
         | 
| 505 492 |  | 
| 506 493 | 
             
                  # for URI::split
         | 
| 507 | 
            -
                  ret[:ABS_URI] = Regexp.new('\A\s | 
| 508 | 
            -
                  ret[:REL_URI] = Regexp.new('\A\s | 
| 494 | 
            +
                  ret[:ABS_URI] = Regexp.new('\A\s*' + pattern[:X_ABS_URI] + '\s*\z', Regexp::EXTENDED)
         | 
| 495 | 
            +
                  ret[:REL_URI] = Regexp.new('\A\s*' + pattern[:X_REL_URI] + '\s*\z', Regexp::EXTENDED)
         | 
| 509 496 |  | 
| 510 497 | 
             
                  # for URI::extract
         | 
| 511 498 | 
             
                  ret[:URI_REF]     = Regexp.new(pattern[:URI_REF])
         | 
    
        data/lib/uri/rfc3986_parser.rb
    CHANGED
    
    | @@ -3,8 +3,8 @@ module URI | |
| 3 3 | 
             
              class RFC3986_Parser # :nodoc:
         | 
| 4 4 | 
             
                # URI defined in RFC3986
         | 
| 5 5 | 
             
                # this regexp is modified not to host is not empty string
         | 
| 6 | 
            -
                RFC3986_URI = /\A(?<URI>(?<scheme>[A-Za-z][+\-.0-9A-Za-z] | 
| 7 | 
            -
                RFC3986_relative_ref = /\A(?<relative-ref>(?<relative-part>\/\/(?<authority>(?:(?<userinfo>(?:%\h\h|[!$&-.0-;=A-Z_a-z~]) | 
| 6 | 
            +
                RFC3986_URI = /\A(?<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/
         | 
| 7 | 
            +
                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/
         | 
| 8 8 | 
             
                attr_reader :regexp
         | 
| 9 9 |  | 
| 10 10 | 
             
                def initialize
         | 
| @@ -69,18 +69,7 @@ module URI | |
| 69 69 | 
             
                end
         | 
| 70 70 |  | 
| 71 71 | 
             
                def parse(uri) # :nodoc:
         | 
| 72 | 
            -
                   | 
| 73 | 
            -
                    registry, path, opaque, query, fragment = self.split(uri)
         | 
| 74 | 
            -
                  scheme_list = URI.scheme_list
         | 
| 75 | 
            -
                  if scheme && scheme_list.include?(uc = scheme.upcase)
         | 
| 76 | 
            -
                    scheme_list[uc].new(scheme, userinfo, host, port,
         | 
| 77 | 
            -
                                        registry, path, opaque, query,
         | 
| 78 | 
            -
                                        fragment, self)
         | 
| 79 | 
            -
                  else
         | 
| 80 | 
            -
                    Generic.new(scheme, userinfo, host, port,
         | 
| 81 | 
            -
                                registry, path, opaque, query,
         | 
| 82 | 
            -
                                fragment, self)
         | 
| 83 | 
            -
                  end
         | 
| 72 | 
            +
                  URI.for(*self.split(uri), self)
         | 
| 84 73 | 
             
                end
         | 
| 85 74 |  | 
| 86 75 |  | 
| @@ -106,7 +95,7 @@ module URI | |
| 106 95 | 
             
                    QUERY: /\A(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*\z/,
         | 
| 107 96 | 
             
                    FRAGMENT: /\A(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*\z/,
         | 
| 108 97 | 
             
                    OPAQUE: /\A(?:[^\/].*)?\z/,
         | 
| 109 | 
            -
                    PORT: /\A[\x09\x0a\x0c\x0d ] | 
| 98 | 
            +
                    PORT: /\A[\x09\x0a\x0c\x0d ]*\d*[\x09\x0a\x0c\x0d ]*\z/,
         | 
| 110 99 | 
             
                  }
         | 
| 111 100 | 
             
                end
         | 
| 112 101 |  | 
    
        data/lib/uri/version.rb
    CHANGED
    
    
    
        data/lib/uri/ws.rb
    ADDED
    
    | @@ -0,0 +1,84 @@ | |
| 1 | 
            +
            # frozen_string_literal: false
         | 
| 2 | 
            +
            # = uri/ws.rb
         | 
| 3 | 
            +
            #
         | 
| 4 | 
            +
            # Author:: Matt Muller <mamuller@amazon.com>
         | 
| 5 | 
            +
            # License:: You can redistribute it and/or modify it under the same term as Ruby.
         | 
| 6 | 
            +
            #
         | 
| 7 | 
            +
            # See URI for general documentation
         | 
| 8 | 
            +
            #
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            require_relative 'generic'
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            module URI
         | 
| 13 | 
            +
             | 
| 14 | 
            +
              #
         | 
| 15 | 
            +
              # The syntax of WS URIs is defined in RFC6455 section 3.
         | 
| 16 | 
            +
              #
         | 
| 17 | 
            +
              # Note that the Ruby URI library allows WS URLs containing usernames and
         | 
| 18 | 
            +
              # passwords. This is not legal as per the RFC, but used to be
         | 
| 19 | 
            +
              # supported in Internet Explorer 5 and 6, before the MS04-004 security
         | 
| 20 | 
            +
              # update. See <URL:http://support.microsoft.com/kb/834489>.
         | 
| 21 | 
            +
              #
         | 
| 22 | 
            +
              class WS < Generic
         | 
| 23 | 
            +
                # A Default port of 80 for URI::WS.
         | 
| 24 | 
            +
                DEFAULT_PORT = 80
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                # An Array of the available components for URI::WS.
         | 
| 27 | 
            +
                COMPONENT = %i[
         | 
| 28 | 
            +
                  scheme
         | 
| 29 | 
            +
                  userinfo host port
         | 
| 30 | 
            +
                  path
         | 
| 31 | 
            +
                  query
         | 
| 32 | 
            +
                ].freeze
         | 
| 33 | 
            +
             | 
| 34 | 
            +
                #
         | 
| 35 | 
            +
                # == Description
         | 
| 36 | 
            +
                #
         | 
| 37 | 
            +
                # Creates a new URI::WS object from components, with syntax checking.
         | 
| 38 | 
            +
                #
         | 
| 39 | 
            +
                # The components accepted are userinfo, host, port, path, and query.
         | 
| 40 | 
            +
                #
         | 
| 41 | 
            +
                # The components should be provided either as an Array, or as a Hash
         | 
| 42 | 
            +
                # with keys formed by preceding the component names with a colon.
         | 
| 43 | 
            +
                #
         | 
| 44 | 
            +
                # If an Array is used, the components must be passed in the
         | 
| 45 | 
            +
                # order <code>[userinfo, host, port, path, query]</code>.
         | 
| 46 | 
            +
                #
         | 
| 47 | 
            +
                # Example:
         | 
| 48 | 
            +
                #
         | 
| 49 | 
            +
                #     uri = URI::WS.build(host: 'www.example.com', path: '/foo/bar')
         | 
| 50 | 
            +
                #
         | 
| 51 | 
            +
                #     uri = URI::WS.build([nil, "www.example.com", nil, "/path", "query"])
         | 
| 52 | 
            +
                #
         | 
| 53 | 
            +
                # Currently, if passed userinfo components this method generates
         | 
| 54 | 
            +
                # invalid WS URIs as per RFC 1738.
         | 
| 55 | 
            +
                #
         | 
| 56 | 
            +
                def self.build(args)
         | 
| 57 | 
            +
                  tmp = Util.make_components_hash(self, args)
         | 
| 58 | 
            +
                  super(tmp)
         | 
| 59 | 
            +
                end
         | 
| 60 | 
            +
             | 
| 61 | 
            +
                #
         | 
| 62 | 
            +
                # == Description
         | 
| 63 | 
            +
                #
         | 
| 64 | 
            +
                # Returns the full path for a WS URI, as required by Net::HTTP::Get.
         | 
| 65 | 
            +
                #
         | 
| 66 | 
            +
                # If the URI contains a query, the full path is URI#path + '?' + URI#query.
         | 
| 67 | 
            +
                # Otherwise, the path is simply URI#path.
         | 
| 68 | 
            +
                #
         | 
| 69 | 
            +
                # Example:
         | 
| 70 | 
            +
                #
         | 
| 71 | 
            +
                #     uri = URI::WS.build(path: '/foo/bar', query: 'test=true')
         | 
| 72 | 
            +
                #     uri.request_uri #  => "/foo/bar?test=true"
         | 
| 73 | 
            +
                #
         | 
| 74 | 
            +
                def request_uri
         | 
| 75 | 
            +
                  return unless @path
         | 
| 76 | 
            +
             | 
| 77 | 
            +
                  url = @query ? "#@path?#@query" : @path.dup
         | 
| 78 | 
            +
                  url.start_with?(?/.freeze) ? url : ?/ + url
         | 
| 79 | 
            +
                end
         | 
| 80 | 
            +
              end
         | 
| 81 | 
            +
             | 
| 82 | 
            +
              @@schemes['WS'] = WS
         | 
| 83 | 
            +
             | 
| 84 | 
            +
            end
         | 
    
        data/lib/uri/wss.rb
    ADDED
    
    | @@ -0,0 +1,22 @@ | |
| 1 | 
            +
            # frozen_string_literal: false
         | 
| 2 | 
            +
            # = uri/wss.rb
         | 
| 3 | 
            +
            #
         | 
| 4 | 
            +
            # Author:: Matt Muller <mamuller@amazon.com>
         | 
| 5 | 
            +
            # License:: You can redistribute it and/or modify it under the same term as Ruby.
         | 
| 6 | 
            +
            #
         | 
| 7 | 
            +
            # See URI for general documentation
         | 
| 8 | 
            +
            #
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            require_relative 'ws'
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            module URI
         | 
| 13 | 
            +
             | 
| 14 | 
            +
              # The default port for WSS URIs is 443, and the scheme is 'wss:' rather
         | 
| 15 | 
            +
              # than 'ws:'. Other than that, WSS URIs are identical to WS URIs;
         | 
| 16 | 
            +
              # see URI::WS.
         | 
| 17 | 
            +
              class WSS < WS
         | 
| 18 | 
            +
                # A Default port of 443 for URI::WSS
         | 
| 19 | 
            +
                DEFAULT_PORT = 443
         | 
| 20 | 
            +
              end
         | 
| 21 | 
            +
              @@schemes['WSS'] = WSS
         | 
| 22 | 
            +
            end
         | 
    
        data/lib/uri.rb
    CHANGED
    
    | @@ -86,19 +86,18 @@ | |
| 86 86 | 
             
            # License::
         | 
| 87 87 | 
             
            #  Copyright (c) 2001 akira yamada <akira@ruby-lang.org>
         | 
| 88 88 | 
             
            #  You can redistribute it and/or modify it under the same term as Ruby.
         | 
| 89 | 
            -
            # Revision:: $Id$
         | 
| 90 89 | 
             
            #
         | 
| 91 90 |  | 
| 92 91 | 
             
            module URI
         | 
| 93 92 | 
             
            end
         | 
| 94 93 |  | 
| 95 | 
            -
             | 
| 96 | 
            -
             | 
| 97 | 
            -
             | 
| 98 | 
            -
             | 
| 99 | 
            -
             | 
| 100 | 
            -
             | 
| 101 | 
            -
             | 
| 102 | 
            -
             | 
| 103 | 
            -
             | 
| 104 | 
            -
             | 
| 94 | 
            +
            require_relative 'uri/version'
         | 
| 95 | 
            +
            require_relative 'uri/common'
         | 
| 96 | 
            +
            require_relative 'uri/generic'
         | 
| 97 | 
            +
            require_relative 'uri/file'
         | 
| 98 | 
            +
            require_relative 'uri/ftp'
         | 
| 99 | 
            +
            require_relative 'uri/http'
         | 
| 100 | 
            +
            require_relative 'uri/https'
         | 
| 101 | 
            +
            require_relative 'uri/ldap'
         | 
| 102 | 
            +
            require_relative 'uri/ldaps'
         | 
| 103 | 
            +
            require_relative 'uri/mailto'
         | 
    
        data/uri.gemspec
    CHANGED
    
    | @@ -13,7 +13,7 @@ Gem::Specification.new do |spec| | |
| 13 13 | 
             
              spec.summary       = %q{URI is a module providing classes to handle Uniform Resource Identifiers}
         | 
| 14 14 | 
             
              spec.description   = spec.summary
         | 
| 15 15 | 
             
              spec.homepage      = "https://github.com/ruby/uri"
         | 
| 16 | 
            -
              spec. | 
| 16 | 
            +
              spec.licenses      = ["Ruby", "BSD-2-Clause"]
         | 
| 17 17 |  | 
| 18 18 | 
             
              spec.metadata["homepage_uri"] = spec.homepage
         | 
| 19 19 | 
             
              spec.metadata["source_code_uri"] = spec.homepage
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: uri
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.10. | 
| 4 | 
            +
              version: 0.10.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Akira Yamada
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2020-12-22 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies: []
         | 
| 13 13 | 
             
            description: URI is a module providing classes to handle Uniform Resource Identifiers
         | 
| 14 14 | 
             
            email:
         | 
| @@ -17,8 +17,8 @@ executables: [] | |
| 17 17 | 
             
            extensions: []
         | 
| 18 18 | 
             
            extra_rdoc_files: []
         | 
| 19 19 | 
             
            files:
         | 
| 20 | 
            +
            - ".github/workflows/test.yml"
         | 
| 20 21 | 
             
            - ".gitignore"
         | 
| 21 | 
            -
            - ".travis.yml"
         | 
| 22 22 | 
             
            - Gemfile
         | 
| 23 23 | 
             
            - LICENSE.txt
         | 
| 24 24 | 
             
            - README.md
         | 
| @@ -38,9 +38,12 @@ files: | |
| 38 38 | 
             
            - lib/uri/rfc2396_parser.rb
         | 
| 39 39 | 
             
            - lib/uri/rfc3986_parser.rb
         | 
| 40 40 | 
             
            - lib/uri/version.rb
         | 
| 41 | 
            +
            - lib/uri/ws.rb
         | 
| 42 | 
            +
            - lib/uri/wss.rb
         | 
| 41 43 | 
             
            - uri.gemspec
         | 
| 42 44 | 
             
            homepage: https://github.com/ruby/uri
         | 
| 43 45 | 
             
            licenses:
         | 
| 46 | 
            +
            - Ruby
         | 
| 44 47 | 
             
            - BSD-2-Clause
         | 
| 45 48 | 
             
            metadata:
         | 
| 46 49 | 
             
              homepage_uri: https://github.com/ruby/uri
         | 
| @@ -60,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 60 63 | 
             
                - !ruby/object:Gem::Version
         | 
| 61 64 | 
             
                  version: '0'
         | 
| 62 65 | 
             
            requirements: []
         | 
| 63 | 
            -
            rubygems_version: 3. | 
| 66 | 
            +
            rubygems_version: 3.2.2
         | 
| 64 67 | 
             
            signing_key:
         | 
| 65 68 | 
             
            specification_version: 4
         | 
| 66 69 | 
             
            summary: URI is a module providing classes to handle Uniform Resource Identifiers
         |