uri 0.13.3 → 1.0.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.

Potentially problematic release.


This version of uri might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2ff198914bae27655aee5c90c174f209e283924fcedd3054a680a1fa13c38420
4
- data.tar.gz: 318d1acef1b37a91a7932dd065956d7526ed27ffe36785b0097524e87bcd31df
3
+ metadata.gz: b3741ee016cae6202bc6cc37831fd66551c7345f042db84e16e0c42a23e73fc4
4
+ data.tar.gz: ca5a5df406aaf613ed27613b56fbc3446596d80aa9541d2299d4ba2a17bf9cf1
5
5
  SHA512:
6
- metadata.gz: d63fae0cebe8d47ba5d8042ed4c98935a991a8fdd95103ac86f0a31c8e1df5861dd38d4121d6b30be7f8079fae998569dab85c3b935efa924c9e3fc05d0effe3
7
- data.tar.gz: a6a56ca12543502cf80b100720a635f443951af35b3c29e651e6cc46441e0c2e863aa20b110f73941a9087bcd4aa3a92e5f2ac5a48f286325e8acf6090303d72
6
+ metadata.gz: 9aa8a131d013045b632d03515ef521609c01c5e0d5a8ce1db18ba48e880a762aeda7ab1d346737681b66ac6a01144ddea78df8c8fbf2b2355cd2d536652bb6bc
7
+ data.tar.gz: bc2f58749df20109f28a758c0938db97f3e190a449082697681493b432a71781fd241bd535c918cb38d067fb3946ac1bd77e21872072858540073b87bdf03966
@@ -23,16 +23,16 @@ jobs:
23
23
  - name: Setup Ruby
24
24
  uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0
25
25
  with:
26
- ruby-version: '3.2'
26
+ ruby-version: '3.3'
27
27
  bundler-cache: true
28
28
  - name: Setup Pages
29
29
  id: pages
30
- uses: actions/configure-pages@v3
30
+ uses: actions/configure-pages@v5
31
31
  - name: Build with RDoc
32
32
  # Outputs to the './_site' directory by default
33
33
  run: bundle exec rake rdoc
34
34
  - name: Upload artifact
35
- uses: actions/upload-pages-artifact@v2
35
+ uses: actions/upload-pages-artifact@v3
36
36
 
37
37
  deploy:
38
38
  environment:
@@ -43,4 +43,4 @@ jobs:
43
43
  steps:
44
44
  - name: Deploy to GitHub Pages
45
45
  id: deployment
46
- uses: actions/deploy-pages@v2
46
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,46 @@
1
+ name: Publish gem to rubygems.org
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ push:
13
+ if: github.repository == 'ruby/uri'
14
+ runs-on: ubuntu-latest
15
+
16
+ environment:
17
+ name: rubygems.org
18
+ url: https://rubygems.org/gems/uri
19
+
20
+ permissions:
21
+ contents: write
22
+ id-token: write
23
+
24
+ steps:
25
+ - name: Harden Runner
26
+ uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
27
+ with:
28
+ egress-policy: audit
29
+
30
+ - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
31
+
32
+ - name: Set up Ruby
33
+ uses: ruby/setup-ruby@a6e6f86333f0a2523ece813039b8b4be04560854 # v1.190.0
34
+ with:
35
+ bundler-cache: true
36
+ ruby-version: ruby
37
+
38
+ - name: Publish to RubyGems
39
+ uses: rubygems/release-gem@612653d273a73bdae1df8453e090060bb4db5f31 # v1
40
+
41
+ - name: Create GitHub release
42
+ run: |
43
+ tag_name="$(git describe --tags --abbrev=0)"
44
+ gh release create "${tag_name}" --verify-tag --generate-notes
45
+ env:
46
+ GITHUB_TOKEN: ${{ secrets.MATZBOT_GITHUB_WORKFLOW_TOKEN }}
@@ -4,10 +4,10 @@ Redistribution and use in source and binary forms, with or without
4
4
  modification, are permitted provided that the following conditions
5
5
  are met:
6
6
  1. Redistributions of source code must retain the above copyright
7
- notice, this list of conditions and the following disclaimer.
7
+ notice, this list of conditions and the following disclaimer.
8
8
  2. Redistributions in binary form must reproduce the above copyright
9
- notice, this list of conditions and the following disclaimer in the
10
- documentation and/or other materials provided with the distribution.
9
+ notice, this list of conditions and the following disclaimer in the
10
+ documentation and/or other materials provided with the distribution.
11
11
 
12
12
  THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
13
13
  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
data/COPYING ADDED
@@ -0,0 +1,56 @@
1
+ Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
2
+ You can redistribute it and/or modify it under either the terms of the
3
+ 2-clause BSDL (see the file BSDL), or the conditions below:
4
+
5
+ 1. You may make and give away verbatim copies of the source form of the
6
+ software without restriction, provided that you duplicate all of the
7
+ original copyright notices and associated disclaimers.
8
+
9
+ 2. You may modify your copy of the software in any way, provided that
10
+ you do at least ONE of the following:
11
+
12
+ a. place your modifications in the Public Domain or otherwise
13
+ make them Freely Available, such as by posting said
14
+ modifications to Usenet or an equivalent medium, or by allowing
15
+ the author to include your modifications in the software.
16
+
17
+ b. use the modified software only within your corporation or
18
+ organization.
19
+
20
+ c. give non-standard binaries non-standard names, with
21
+ instructions on where to get the original software distribution.
22
+
23
+ d. make other distribution arrangements with the author.
24
+
25
+ 3. You may distribute the software in object code or binary form,
26
+ provided that you do at least ONE of the following:
27
+
28
+ a. distribute the binaries and library files of the software,
29
+ together with instructions (in the manual page or equivalent)
30
+ on where to get the original distribution.
31
+
32
+ b. accompany the distribution with the machine-readable source of
33
+ the software.
34
+
35
+ c. give non-standard binaries non-standard names, with
36
+ instructions on where to get the original software distribution.
37
+
38
+ d. make other distribution arrangements with the author.
39
+
40
+ 4. You may modify and include the part of the software into any other
41
+ software (possibly commercial). But some files in the distribution
42
+ are not written by the author, so that they are not under these terms.
43
+
44
+ For the list of those files and their copying conditions, see the
45
+ file LEGAL.
46
+
47
+ 5. The scripts and library files supplied as input to or produced as
48
+ output from the software do not automatically fall under the
49
+ copyright of the software, but belong to whomever generated them,
50
+ and may be sold commercially, and may be aggregated with this
51
+ software.
52
+
53
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
54
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
55
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
56
+ PURPOSE.
data/lib/uri/common.rb CHANGED
@@ -13,26 +13,46 @@ require_relative "rfc2396_parser"
13
13
  require_relative "rfc3986_parser"
14
14
 
15
15
  module URI
16
- include RFC2396_REGEXP
16
+ RFC2396_PARSER = RFC2396_Parser.new
17
+ Ractor.make_shareable(RFC2396_PARSER) if defined?(Ractor)
17
18
 
18
- REGEXP = RFC2396_REGEXP
19
- Parser = RFC2396_Parser
20
19
  RFC3986_PARSER = RFC3986_Parser.new
21
20
  Ractor.make_shareable(RFC3986_PARSER) if defined?(Ractor)
22
- RFC2396_PARSER = RFC2396_Parser.new
23
- Ractor.make_shareable(RFC2396_PARSER) if defined?(Ractor)
24
21
 
25
- # URI::Parser.new
26
- DEFAULT_PARSER = Parser.new
27
- DEFAULT_PARSER.pattern.each_pair do |sym, str|
28
- unless REGEXP::PATTERN.const_defined?(sym)
29
- REGEXP::PATTERN.const_set(sym, str)
22
+ DEFAULT_PARSER = RFC3986_PARSER
23
+ Ractor.make_shareable(DEFAULT_PARSER) if defined?(Ractor)
24
+
25
+ def self.parser=(parser = RFC3986_PARSER)
26
+ remove_const(:Parser) if defined?(::URI::Parser)
27
+ const_set("Parser", parser.class)
28
+
29
+ remove_const(:REGEXP) if defined?(::URI::REGEXP)
30
+ remove_const(:PATTERN) if defined?(::URI::PATTERN)
31
+ if Parser == RFC2396_Parser
32
+ const_set("REGEXP", URI::RFC2396_REGEXP)
33
+ const_set("PATTERN", URI::RFC2396_REGEXP::PATTERN)
34
+ Parser.new.pattern.each_pair do |sym, str|
35
+ unless REGEXP::PATTERN.const_defined?(sym)
36
+ REGEXP::PATTERN.const_set(sym, str)
37
+ end
38
+ end
39
+ end
40
+
41
+ Parser.new.regexp.each_pair do |sym, str|
42
+ remove_const(sym) if const_defined?(sym)
43
+ const_set(sym, str)
30
44
  end
31
45
  end
32
- DEFAULT_PARSER.regexp.each_pair do |sym, str|
33
- const_set(sym, str)
46
+ self.parser = RFC3986_PARSER
47
+
48
+ def self.const_missing(const)
49
+ if value = RFC2396_PARSER.regexp[const]
50
+ warn "URI::#{const} is obsolete. Use RFC2396_PARSER.regexp[#{const.inspect}] explicitly.", uplevel: 1 if $VERBOSE
51
+ value
52
+ else
53
+ super
54
+ end
34
55
  end
35
- Ractor.make_shareable(DEFAULT_PARSER) if defined?(Ractor)
36
56
 
37
57
  module Util # :nodoc:
38
58
  def make_components_hash(klass, array_hash)
@@ -170,7 +190,7 @@ module URI
170
190
  # ["fragment", "top"]]
171
191
  #
172
192
  def self.split(uri)
173
- RFC3986_PARSER.split(uri)
193
+ DEFAULT_PARSER.split(uri)
174
194
  end
175
195
 
176
196
  # Returns a new \URI object constructed from the given string +uri+:
@@ -184,7 +204,7 @@ module URI
184
204
  # if it may contain invalid URI characters.
185
205
  #
186
206
  def self.parse(uri)
187
- RFC3986_PARSER.parse(uri)
207
+ DEFAULT_PARSER.parse(uri)
188
208
  end
189
209
 
190
210
  # Merges the given URI strings +str+
@@ -211,7 +231,7 @@ module URI
211
231
  # # => #<URI::HTTP http://example.com/foo/bar>
212
232
  #
213
233
  def self.join(*str)
214
- RFC3986_PARSER.join(*str)
234
+ DEFAULT_PARSER.join(*str)
215
235
  end
216
236
 
217
237
  #
data/lib/uri/file.rb CHANGED
@@ -70,17 +70,17 @@ module URI
70
70
 
71
71
  # raise InvalidURIError
72
72
  def check_userinfo(user)
73
- raise URI::InvalidURIError, "can not set userinfo for file URI"
73
+ raise URI::InvalidURIError, "cannot set userinfo for file URI"
74
74
  end
75
75
 
76
76
  # raise InvalidURIError
77
77
  def check_user(user)
78
- raise URI::InvalidURIError, "can not set user for file URI"
78
+ raise URI::InvalidURIError, "cannot set user for file URI"
79
79
  end
80
80
 
81
81
  # raise InvalidURIError
82
82
  def check_password(user)
83
- raise URI::InvalidURIError, "can not set password for file URI"
83
+ raise URI::InvalidURIError, "cannot set password for file URI"
84
84
  end
85
85
 
86
86
  # do nothing
data/lib/uri/ftp.rb CHANGED
@@ -17,7 +17,7 @@ module URI
17
17
  # This class will be redesigned because of difference of implementations;
18
18
  # the structure of its path. draft-hoffman-ftp-uri-04 is a draft but it
19
19
  # is a good summary about the de facto spec.
20
- # http://tools.ietf.org/html/draft-hoffman-ftp-uri-04
20
+ # https://datatracker.ietf.org/doc/html/draft-hoffman-ftp-uri-04
21
21
  #
22
22
  class FTP < Generic
23
23
  # A Default port of 21 for URI::FTP.
data/lib/uri/generic.rb CHANGED
@@ -82,7 +82,7 @@ module URI
82
82
  if args.kind_of?(Array)
83
83
  return self.build(args.collect{|x|
84
84
  if x.is_a?(String)
85
- DEFAULT_PARSER.escape(x)
85
+ URI::RFC2396_PARSER.escape(x)
86
86
  else
87
87
  x
88
88
  end
@@ -91,7 +91,7 @@ module URI
91
91
  tmp = {}
92
92
  args.each do |key, value|
93
93
  tmp[key] = if value
94
- DEFAULT_PARSER.escape(value)
94
+ URI::RFC2396_PARSER.escape(value)
95
95
  else
96
96
  value
97
97
  end
@@ -186,18 +186,18 @@ module URI
186
186
 
187
187
  if arg_check
188
188
  self.scheme = scheme
189
+ self.userinfo = userinfo
189
190
  self.hostname = host
190
191
  self.port = port
191
- self.userinfo = userinfo
192
192
  self.path = path
193
193
  self.query = query
194
194
  self.opaque = opaque
195
195
  self.fragment = fragment
196
196
  else
197
197
  self.set_scheme(scheme)
198
+ self.set_userinfo(userinfo)
198
199
  self.set_host(host)
199
200
  self.set_port(port)
200
- self.set_userinfo(userinfo)
201
201
  self.set_path(path)
202
202
  self.query = query
203
203
  self.set_opaque(opaque)
@@ -393,7 +393,7 @@ module URI
393
393
  def check_user(v)
394
394
  if @opaque
395
395
  raise InvalidURIError,
396
- "can not set user with opaque"
396
+ "cannot set user with opaque"
397
397
  end
398
398
 
399
399
  return v unless v
@@ -417,7 +417,7 @@ module URI
417
417
  def check_password(v, user = @user)
418
418
  if @opaque
419
419
  raise InvalidURIError,
420
- "can not set password with opaque"
420
+ "cannot set password with opaque"
421
421
  end
422
422
  return v unless v
423
423
 
@@ -511,7 +511,7 @@ module URI
511
511
  user, password = split_userinfo(user)
512
512
  end
513
513
  @user = user
514
- @password = password
514
+ @password = password if password
515
515
 
516
516
  [@user, @password]
517
517
  end
@@ -522,7 +522,7 @@ module URI
522
522
  # See also URI::Generic.user=.
523
523
  #
524
524
  def set_user(v)
525
- set_userinfo(v, nil)
525
+ set_userinfo(v, @password)
526
526
  v
527
527
  end
528
528
  protected :set_user
@@ -574,12 +574,6 @@ module URI
574
574
  @password
575
575
  end
576
576
 
577
- # Returns the authority info (array of user, password, host and
578
- # port), if any is set. Or returns +nil+.
579
- def authority
580
- return @user, @password, @host, @port if @user || @password || @host || @port
581
- end
582
-
583
577
  # Returns the user component after URI decoding.
584
578
  def decoded_user
585
579
  URI.decode_uri_component(@user) if @user
@@ -602,7 +596,7 @@ module URI
602
596
 
603
597
  if @opaque
604
598
  raise InvalidURIError,
605
- "can not set host with registry or opaque"
599
+ "cannot set host with registry or opaque"
606
600
  elsif parser.regexp[:HOST] !~ v
607
601
  raise InvalidComponentError,
608
602
  "bad component(expected host component): #{v}"
@@ -621,13 +615,6 @@ module URI
621
615
  end
622
616
  protected :set_host
623
617
 
624
- # Protected setter for the authority info (+user+, +password+, +host+
625
- # and +port+). If +port+ is +nil+, +default_port+ will be set.
626
- #
627
- protected def set_authority(user, password, host, port = nil)
628
- @user, @password, @host, @port = user, password, host, port || self.default_port
629
- end
630
-
631
618
  #
632
619
  # == Args
633
620
  #
@@ -652,7 +639,6 @@ module URI
652
639
  def host=(v)
653
640
  check_host(v)
654
641
  set_host(v)
655
- set_userinfo(nil)
656
642
  v
657
643
  end
658
644
 
@@ -699,7 +685,7 @@ module URI
699
685
 
700
686
  if @opaque
701
687
  raise InvalidURIError,
702
- "can not set port with registry or opaque"
688
+ "cannot set port with registry or opaque"
703
689
  elsif !v.kind_of?(Integer) && parser.regexp[:PORT] !~ v
704
690
  raise InvalidComponentError,
705
691
  "bad component(expected port component): #{v.inspect}"
@@ -743,22 +729,21 @@ module URI
743
729
  def port=(v)
744
730
  check_port(v)
745
731
  set_port(v)
746
- set_userinfo(nil)
747
732
  port
748
733
  end
749
734
 
750
735
  def check_registry(v) # :nodoc:
751
- raise InvalidURIError, "can not set registry"
736
+ raise InvalidURIError, "cannot set registry"
752
737
  end
753
738
  private :check_registry
754
739
 
755
740
  def set_registry(v) #:nodoc:
756
- raise InvalidURIError, "can not set registry"
741
+ raise InvalidURIError, "cannot set registry"
757
742
  end
758
743
  protected :set_registry
759
744
 
760
745
  def registry=(v)
761
- raise InvalidURIError, "can not set registry"
746
+ raise InvalidURIError, "cannot set registry"
762
747
  end
763
748
 
764
749
  #
@@ -881,7 +866,7 @@ module URI
881
866
  # hier_part = ( net_path | abs_path ) [ "?" query ]
882
867
  if @host || @port || @user || @path # userinfo = @user + ':' + @password
883
868
  raise InvalidURIError,
884
- "can not set opaque with host, port, userinfo or path"
869
+ "cannot set opaque with host, port, userinfo or path"
885
870
  elsif v && parser.regexp[:OPAQUE] !~ v
886
871
  raise InvalidComponentError,
887
872
  "bad component(expected opaque component): #{v}"
@@ -960,7 +945,7 @@ module URI
960
945
  # == Description
961
946
  #
962
947
  # URI has components listed in order of decreasing significance from left to right,
963
- # see RFC3986 https://tools.ietf.org/html/rfc3986 1.2.3.
948
+ # see RFC3986 https://www.rfc-editor.org/rfc/rfc3986 1.2.3.
964
949
  #
965
950
  # == Usage
966
951
  #
@@ -1136,7 +1121,7 @@ module URI
1136
1121
 
1137
1122
  base = self.dup
1138
1123
 
1139
- authority = rel.authority
1124
+ authority = rel.userinfo || rel.host || rel.port
1140
1125
 
1141
1126
  # RFC2396, Section 5.2, 2)
1142
1127
  if (rel.path.nil? || rel.path.empty?) && !authority && !rel.query
@@ -1148,14 +1133,17 @@ module URI
1148
1133
  base.fragment=(nil)
1149
1134
 
1150
1135
  # RFC2396, Section 5.2, 4)
1151
- if authority
1152
- base.set_authority(*authority)
1153
- base.set_path(rel.path)
1154
- elsif base.path && rel.path
1155
- base.set_path(merge_path(base.path, rel.path))
1136
+ if !authority
1137
+ base.set_path(merge_path(base.path, rel.path)) if base.path && rel.path
1138
+ else
1139
+ # RFC2396, Section 5.2, 4)
1140
+ base.set_path(rel.path) if rel.path
1156
1141
  end
1157
1142
 
1158
1143
  # RFC2396, Section 5.2, 7)
1144
+ base.set_userinfo(rel.userinfo) if rel.userinfo
1145
+ base.set_host(rel.host) if rel.host
1146
+ base.set_port(rel.port) if rel.port
1159
1147
  base.query = rel.query if rel.query
1160
1148
  base.fragment=(rel.fragment) if rel.fragment
1161
1149
 
@@ -1247,7 +1235,7 @@ module URI
1247
1235
  return rel, rel
1248
1236
  end
1249
1237
 
1250
- # you can modify `rel', but can not `oth'.
1238
+ # you can modify `rel', but cannot `oth'.
1251
1239
  return oth, rel
1252
1240
  end
1253
1241
  private :route_from0
@@ -1272,7 +1260,7 @@ module URI
1272
1260
  # #=> #<URI::Generic /main.rbx?page=1>
1273
1261
  #
1274
1262
  def route_from(oth)
1275
- # you can modify `rel', but can not `oth'.
1263
+ # you can modify `rel', but cannot `oth'.
1276
1264
  begin
1277
1265
  oth, rel = route_from0(oth)
1278
1266
  rescue
@@ -1376,6 +1364,9 @@ module URI
1376
1364
  str << ':'
1377
1365
  str << @port.to_s
1378
1366
  end
1367
+ if (@host || @port) && !@path.empty? && !@path.start_with?('/')
1368
+ str << '/'
1369
+ end
1379
1370
  str << @path
1380
1371
  if @query
1381
1372
  str << '?'
@@ -1411,19 +1402,6 @@ module URI
1411
1402
  self.component_ary.eql?(oth.component_ary)
1412
1403
  end
1413
1404
 
1414
- =begin
1415
-
1416
- --- URI::Generic#===(oth)
1417
-
1418
- =end
1419
- # def ===(oth)
1420
- # raise NotImplementedError
1421
- # end
1422
-
1423
- =begin
1424
- =end
1425
-
1426
-
1427
1405
  # Returns an Array of the components defined from the COMPONENT Array.
1428
1406
  def component_ary
1429
1407
  component.collect do |x|
data/lib/uri/http.rb CHANGED
@@ -85,7 +85,7 @@ module URI
85
85
  # == Description
86
86
  #
87
87
  # Returns the authority for an HTTP uri, as defined in
88
- # https://datatracker.ietf.org/doc/html/rfc3986/#section-3.2.
88
+ # https://www.rfc-editor.org/rfc/rfc3986#section-3.2.
89
89
  #
90
90
  #
91
91
  # Example:
@@ -106,7 +106,7 @@ module URI
106
106
  # == Description
107
107
  #
108
108
  # Returns the origin for an HTTP uri, as defined in
109
- # https://datatracker.ietf.org/doc/html/rfc6454.
109
+ # https://www.rfc-editor.org/rfc/rfc6454.
110
110
  #
111
111
  #
112
112
  # Example:
@@ -140,11 +140,11 @@ module URI
140
140
 
141
141
  if !scheme
142
142
  raise InvalidURIError,
143
- "bad URI(absolute but no scheme): #{uri}"
143
+ "bad URI (absolute but no scheme): #{uri}"
144
144
  end
145
145
  if !opaque && (!path && (!host && !registry))
146
146
  raise InvalidURIError,
147
- "bad URI(absolute but no path): #{uri}"
147
+ "bad URI (absolute but no path): #{uri}"
148
148
  end
149
149
 
150
150
  when @regexp[:REL_URI]
@@ -173,7 +173,7 @@ module URI
173
173
  # server = [ [ userinfo "@" ] hostport ]
174
174
 
175
175
  else
176
- raise InvalidURIError, "bad URI(is not URI?): #{uri}"
176
+ raise InvalidURIError, "bad URI (is not URI?): #{uri}"
177
177
  end
178
178
 
179
179
  path = '' if !path && !opaque # (see RFC2396 Section 5.2)
@@ -78,7 +78,7 @@ module URI
78
78
  begin
79
79
  uri = uri.to_str
80
80
  rescue NoMethodError
81
- raise InvalidURIError, "bad URI(is not URI?): #{uri.inspect}"
81
+ raise InvalidURIError, "bad URI (is not URI?): #{uri.inspect}"
82
82
  end
83
83
  uri.ascii_only? or
84
84
  raise InvalidURIError, "URI must be ascii only #{uri.dump}"
@@ -127,7 +127,7 @@ module URI
127
127
  m["fragment"]
128
128
  ]
129
129
  else
130
- raise InvalidURIError, "bad URI(is not URI?): #{uri.inspect}"
130
+ raise InvalidURIError, "bad URI (is not URI?): #{uri.inspect}"
131
131
  end
132
132
  end
133
133
 
@@ -135,12 +135,35 @@ module URI
135
135
  URI.for(*self.split(uri), self)
136
136
  end
137
137
 
138
-
139
138
  def join(*uris) # :nodoc:
140
139
  uris[0] = convert_to_uri(uris[0])
141
140
  uris.inject :merge
142
141
  end
143
142
 
143
+ # Compatibility for RFC2396 parser
144
+ def extract(str, schemes = nil, &block) # :nodoc:
145
+ warn "URI::RFC3986_PARSER.extract is obsoleted. Use URI::RFC2396_PARSER.extract explicitly.", uplevel: 1 if $VERBOSE
146
+ RFC2396_PARSER.extract(str, schemes, &block)
147
+ end
148
+
149
+ # Compatibility for RFC2396 parser
150
+ def make_regexp(schemes = nil) # :nodoc:
151
+ warn "URI::RFC3986_PARSER.make_regexp is obsoleted. Use URI::RFC2396_PARSER.make_regexp explicitly.", uplevel: 1 if $VERBOSE
152
+ RFC2396_PARSER.make_regexp(schemes)
153
+ end
154
+
155
+ # Compatibility for RFC2396 parser
156
+ def escape(str, unsafe = nil) # :nodoc:
157
+ warn "URI::RFC3986_PARSER.escape is obsoleted. Use URI::RFC2396_PARSER.escape explicitly.", uplevel: 1 if $VERBOSE
158
+ unsafe ? RFC2396_PARSER.escape(str, unsafe) : RFC2396_PARSER.escape(str)
159
+ end
160
+
161
+ # Compatibility for RFC2396 parser
162
+ def unescape(str, escaped = nil) # :nodoc:
163
+ warn "URI::RFC3986_PARSER.unescape is obsoleted. Use URI::RFC2396_PARSER.unescape explicitly.", uplevel: 1 if $VERBOSE
164
+ escaped ? RFC2396_PARSER.unescape(str, escaped) : RFC2396_PARSER.unescape(str)
165
+ end
166
+
144
167
  @@to_s = Kernel.instance_method(:to_s)
145
168
  if @@to_s.respond_to?(:bind_call)
146
169
  def inspect
data/lib/uri/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module URI
2
2
  # :stopdoc:
3
- VERSION_CODE = '001303'.freeze
3
+ VERSION_CODE = '010000'.freeze
4
4
  VERSION = VERSION_CODE.scan(/../).collect{|n| n.to_i}.join('.').freeze
5
5
  # :startdoc:
6
6
  end
data/lib/uri.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: false
2
2
  # URI is a module providing classes to handle Uniform Resource Identifiers
3
- # (RFC2396[http://tools.ietf.org/html/rfc2396]).
3
+ # (RFC2396[https://www.rfc-editor.org/rfc/rfc2396]).
4
4
  #
5
5
  # == Features
6
6
  #
@@ -47,14 +47,14 @@
47
47
  # A good place to view an RFC spec is http://www.ietf.org/rfc.html.
48
48
  #
49
49
  # Here is a list of all related RFC's:
50
- # - RFC822[http://tools.ietf.org/html/rfc822]
51
- # - RFC1738[http://tools.ietf.org/html/rfc1738]
52
- # - RFC2255[http://tools.ietf.org/html/rfc2255]
53
- # - RFC2368[http://tools.ietf.org/html/rfc2368]
54
- # - RFC2373[http://tools.ietf.org/html/rfc2373]
55
- # - RFC2396[http://tools.ietf.org/html/rfc2396]
56
- # - RFC2732[http://tools.ietf.org/html/rfc2732]
57
- # - RFC3986[http://tools.ietf.org/html/rfc3986]
50
+ # - RFC822[https://www.rfc-editor.org/rfc/rfc822]
51
+ # - RFC1738[https://www.rfc-editor.org/rfc/rfc1738]
52
+ # - RFC2255[https://www.rfc-editor.org/rfc/rfc2255]
53
+ # - RFC2368[https://www.rfc-editor.org/rfc/rfc2368]
54
+ # - RFC2373[https://www.rfc-editor.org/rfc/rfc2373]
55
+ # - RFC2396[https://www.rfc-editor.org/rfc/rfc2396]
56
+ # - RFC2732[https://www.rfc-editor.org/rfc/rfc2732]
57
+ # - RFC3986[https://www.rfc-editor.org/rfc/rfc3986]
58
58
  #
59
59
  # == Class tree
60
60
  #
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uri
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akira Yamada
8
+ autorequire:
8
9
  bindir: exe
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2024-11-07 00:00:00.000000000 Z
11
12
  dependencies: []
12
13
  description: URI is a module providing classes to handle Uniform Resource Identifiers
13
14
  email:
@@ -18,10 +19,12 @@ extra_rdoc_files: []
18
19
  files:
19
20
  - ".github/dependabot.yml"
20
21
  - ".github/workflows/gh-pages.yml"
22
+ - ".github/workflows/push_gem.yml"
21
23
  - ".github/workflows/test.yml"
22
24
  - ".gitignore"
25
+ - BSDL
26
+ - COPYING
23
27
  - Gemfile
24
- - LICENSE.txt
25
28
  - README.md
26
29
  - Rakefile
27
30
  - bin/console
@@ -53,6 +56,7 @@ metadata:
53
56
  documentation_uri: https://ruby.github.io/uri/
54
57
  homepage_uri: https://github.com/ruby/uri
55
58
  source_code_uri: https://github.com/ruby/uri
59
+ post_install_message:
56
60
  rdoc_options: []
57
61
  require_paths:
58
62
  - lib
@@ -67,7 +71,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
71
  - !ruby/object:Gem::Version
68
72
  version: '0'
69
73
  requirements: []
70
- rubygems_version: 3.8.0.dev
74
+ rubygems_version: 3.5.11
75
+ signing_key:
71
76
  specification_version: 4
72
77
  summary: URI is a module providing classes to handle Uniform Resource Identifiers
73
78
  test_files: []