uri 0.13.1 → 1.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3aa899933652aa155b60babf100c7b892a976a70121c16a408313687b85be675
4
- data.tar.gz: 2c1f5cdfa19249b82f3c84f7c090eb389e9079147d22db436265b43c2cf283f1
3
+ metadata.gz: 5e32cdbfcc4ace0d2d7725f91df557f0f63cd09eedbacd13134457b5d6186b6b
4
+ data.tar.gz: a8afae357ba17c192629c04a27c615baac982d83659ed0ad56ec248e53eec823
5
5
  SHA512:
6
- metadata.gz: 709ffc67b67a2de85fc86c8317537e6aced97c17abf8111f9c682d0232a46610ef0f769a9fdaf0802689e08a81b83a6cb2d9a9981b0c335513203171966e7251
7
- data.tar.gz: f92761f35747c21ed9e5e11d7390c786be62548bc9f83a5de9b7c25fb0b9c3378ee8c20d1938dcc8e88a7d47de2996ed8c7fed6b970e96a9c967e5ce7f27a41a
6
+ metadata.gz: 5fd294d6b44511a930257f6422525c100c8f5bb3cf9ecc9a8c2afbcda6bd2c863a0ece45450dc0bcb611de7815f8e5dcf398fa1c44f88dfb5df34fc111ffa98a
7
+ data.tar.gz: 022475711eb79ff13b44b19efdba281d50729f5517d01e68da2a6943192546ed2d2cacea17f7b01774e1b4ce8765dbdb79f81390f69f7cbc8d3935947755eca9
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ BSDL
2
+ COPYING
3
+ README.md
4
+ docs/
5
+ lib/
data/.rdoc_options ADDED
@@ -0,0 +1,4 @@
1
+ main_page: README.md
2
+ op_dir: _site
3
+ warn_missing_rdoc_ref: true
4
+ title: URI Documentation
@@ -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/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![CI](https://github.com/ruby/uri/actions/workflows/test.yml/badge.svg)](https://github.com/ruby/uri/actions/workflows/test.yml)
4
4
  [![Yard Docs](https://img.shields.io/badge/docs-exist-blue.svg)](https://ruby.github.io/uri/)
5
5
 
6
- URI is a module providing classes to handle Uniform Resource Identifiers [RFC2396](http://tools.ietf.org/html/rfc2396).
6
+ URI is a module providing classes to handle Uniform Resource Identifiers [RFC3986](http://tools.ietf.org/html/rfc3986).
7
7
 
8
8
  ## Features
9
9
 
data/docs/kernel.rb ADDED
@@ -0,0 +1,2 @@
1
+ # :stopdoc:
2
+ module Kernel end
data/lib/uri/common.rb CHANGED
@@ -13,26 +13,51 @@ require_relative "rfc2396_parser"
13
13
  require_relative "rfc3986_parser"
14
14
 
15
15
  module URI
16
- include RFC2396_REGEXP
16
+ # The default parser instance for RFC 2396.
17
+ RFC2396_PARSER = RFC2396_Parser.new
18
+ Ractor.make_shareable(RFC2396_PARSER) if defined?(Ractor)
17
19
 
18
- REGEXP = RFC2396_REGEXP
19
- Parser = RFC2396_Parser
20
+ # The default parser instance for RFC 3986.
20
21
  RFC3986_PARSER = RFC3986_Parser.new
21
22
  Ractor.make_shareable(RFC3986_PARSER) if defined?(Ractor)
22
- RFC2396_PARSER = RFC2396_Parser.new
23
- Ractor.make_shareable(RFC2396_PARSER) if defined?(Ractor)
24
23
 
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)
24
+ # The default parser instance.
25
+ DEFAULT_PARSER = RFC3986_PARSER
26
+ Ractor.make_shareable(DEFAULT_PARSER) if defined?(Ractor)
27
+
28
+ # Set the default parser instance.
29
+ def self.parser=(parser = RFC3986_PARSER)
30
+ remove_const(:Parser) if defined?(::URI::Parser)
31
+ const_set("Parser", parser.class)
32
+
33
+ remove_const(:REGEXP) if defined?(::URI::REGEXP)
34
+ remove_const(:PATTERN) if defined?(::URI::PATTERN)
35
+ if Parser == RFC2396_Parser
36
+ const_set("REGEXP", URI::RFC2396_REGEXP)
37
+ const_set("PATTERN", URI::RFC2396_REGEXP::PATTERN)
38
+ end
39
+
40
+ Parser.new.regexp.each_pair do |sym, str|
41
+ remove_const(sym) if const_defined?(sym, false)
42
+ const_set(sym, str)
30
43
  end
31
44
  end
32
- DEFAULT_PARSER.regexp.each_pair do |sym, str|
33
- const_set(sym, str)
45
+ self.parser = RFC3986_PARSER
46
+
47
+ def self.const_missing(const) # :nodoc:
48
+ if const == :REGEXP
49
+ warn "URI::REGEXP is obsolete. Use URI::RFC2396_REGEXP explicitly.", uplevel: 1 if $VERBOSE
50
+ URI::RFC2396_REGEXP
51
+ elsif value = RFC2396_PARSER.regexp[const]
52
+ warn "URI::#{const} is obsolete. Use RFC2396_PARSER.regexp[#{const.inspect}] explicitly.", uplevel: 1 if $VERBOSE
53
+ value
54
+ elsif value = RFC2396_Parser.const_get(const)
55
+ warn "URI::#{const} is obsolete. Use RFC2396_Parser::#{const} explicitly.", uplevel: 1 if $VERBOSE
56
+ value
57
+ else
58
+ super
59
+ end
34
60
  end
35
- Ractor.make_shareable(DEFAULT_PARSER) if defined?(Ractor)
36
61
 
37
62
  module Util # :nodoc:
38
63
  def make_components_hash(klass, array_hash)
@@ -66,7 +91,7 @@ module URI
66
91
  module_function :make_components_hash
67
92
  end
68
93
 
69
- module Schemes
94
+ module Schemes # :nodoc:
70
95
  end
71
96
  private_constant :Schemes
72
97
 
@@ -170,7 +195,7 @@ module URI
170
195
  # ["fragment", "top"]]
171
196
  #
172
197
  def self.split(uri)
173
- RFC3986_PARSER.split(uri)
198
+ DEFAULT_PARSER.split(uri)
174
199
  end
175
200
 
176
201
  # Returns a new \URI object constructed from the given string +uri+:
@@ -184,7 +209,7 @@ module URI
184
209
  # if it may contain invalid URI characters.
185
210
  #
186
211
  def self.parse(uri)
187
- RFC3986_PARSER.parse(uri)
212
+ DEFAULT_PARSER.parse(uri)
188
213
  end
189
214
 
190
215
  # Merges the given URI strings +str+
@@ -211,7 +236,7 @@ module URI
211
236
  # # => #<URI::HTTP http://example.com/foo/bar>
212
237
  #
213
238
  def self.join(*str)
214
- RFC3986_PARSER.join(*str)
239
+ DEFAULT_PARSER.join(*str)
215
240
  end
216
241
 
217
242
  #
@@ -284,7 +309,7 @@ module URI
284
309
  256.times do |i|
285
310
  TBLENCWWWCOMP_[-i.chr] = -('%%%02X' % i)
286
311
  end
287
- TBLENCURICOMP_ = TBLENCWWWCOMP_.dup.freeze
312
+ TBLENCURICOMP_ = TBLENCWWWCOMP_.dup.freeze # :nodoc:
288
313
  TBLENCWWWCOMP_[' '] = '+'
289
314
  TBLENCWWWCOMP_.freeze
290
315
  TBLDECWWWCOMP_ = {} # :nodoc:
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
@@ -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
 
@@ -596,7 +596,7 @@ module URI
596
596
 
597
597
  if @opaque
598
598
  raise InvalidURIError,
599
- "can not set host with registry or opaque"
599
+ "cannot set host with registry or opaque"
600
600
  elsif parser.regexp[:HOST] !~ v
601
601
  raise InvalidComponentError,
602
602
  "bad component(expected host component): #{v}"
@@ -685,7 +685,7 @@ module URI
685
685
 
686
686
  if @opaque
687
687
  raise InvalidURIError,
688
- "can not set port with registry or opaque"
688
+ "cannot set port with registry or opaque"
689
689
  elsif !v.kind_of?(Integer) && parser.regexp[:PORT] !~ v
690
690
  raise InvalidComponentError,
691
691
  "bad component(expected port component): #{v.inspect}"
@@ -733,17 +733,17 @@ module URI
733
733
  end
734
734
 
735
735
  def check_registry(v) # :nodoc:
736
- raise InvalidURIError, "can not set registry"
736
+ raise InvalidURIError, "cannot set registry"
737
737
  end
738
738
  private :check_registry
739
739
 
740
- def set_registry(v) #:nodoc:
741
- raise InvalidURIError, "can not set registry"
740
+ def set_registry(v) # :nodoc:
741
+ raise InvalidURIError, "cannot set registry"
742
742
  end
743
743
  protected :set_registry
744
744
 
745
- def registry=(v)
746
- raise InvalidURIError, "can not set registry"
745
+ def registry=(v) # :nodoc:
746
+ raise InvalidURIError, "cannot set registry"
747
747
  end
748
748
 
749
749
  #
@@ -866,7 +866,7 @@ module URI
866
866
  # hier_part = ( net_path | abs_path ) [ "?" query ]
867
867
  if @host || @port || @user || @path # userinfo = @user + ':' + @password
868
868
  raise InvalidURIError,
869
- "can not set opaque with host, port, userinfo or path"
869
+ "cannot set opaque with host, port, userinfo or path"
870
870
  elsif v && parser.regexp[:OPAQUE] !~ v
871
871
  raise InvalidComponentError,
872
872
  "bad component(expected opaque component): #{v}"
@@ -945,7 +945,7 @@ module URI
945
945
  # == Description
946
946
  #
947
947
  # URI has components listed in order of decreasing significance from left to right,
948
- # see RFC3986 https://tools.ietf.org/html/rfc3986 1.2.3.
948
+ # see RFC3986 https://www.rfc-editor.org/rfc/rfc3986 1.2.3.
949
949
  #
950
950
  # == Usage
951
951
  #
@@ -1133,17 +1133,16 @@ module URI
1133
1133
  base.fragment=(nil)
1134
1134
 
1135
1135
  # RFC2396, Section 5.2, 4)
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
1136
+ if authority
1137
+ base.set_userinfo(rel.userinfo)
1138
+ base.set_host(rel.host)
1139
+ base.set_port(rel.port || base.default_port)
1140
+ base.set_path(rel.path)
1141
+ elsif base.path && rel.path
1142
+ base.set_path(merge_path(base.path, rel.path))
1141
1143
  end
1142
1144
 
1143
1145
  # 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
1147
1146
  base.query = rel.query if rel.query
1148
1147
  base.fragment=(rel.fragment) if rel.fragment
1149
1148
 
@@ -1235,7 +1234,7 @@ module URI
1235
1234
  return rel, rel
1236
1235
  end
1237
1236
 
1238
- # you can modify `rel', but can not `oth'.
1237
+ # you can modify `rel', but cannot `oth'.
1239
1238
  return oth, rel
1240
1239
  end
1241
1240
  private :route_from0
@@ -1260,7 +1259,7 @@ module URI
1260
1259
  # #=> #<URI::Generic /main.rbx?page=1>
1261
1260
  #
1262
1261
  def route_from(oth)
1263
- # you can modify `rel', but can not `oth'.
1262
+ # you can modify `rel', but cannot `oth'.
1264
1263
  begin
1265
1264
  oth, rel = route_from0(oth)
1266
1265
  rescue
@@ -1364,6 +1363,9 @@ module URI
1364
1363
  str << ':'
1365
1364
  str << @port.to_s
1366
1365
  end
1366
+ if (@host || @port) && !@path.empty? && !@path.start_with?('/')
1367
+ str << '/'
1368
+ end
1367
1369
  str << @path
1368
1370
  if @query
1369
1371
  str << '?'
@@ -1389,29 +1391,18 @@ module URI
1389
1391
  end
1390
1392
  end
1391
1393
 
1394
+ # Returns the hash value.
1392
1395
  def hash
1393
1396
  self.component_ary.hash
1394
1397
  end
1395
1398
 
1399
+ # Compares with _oth_ for Hash.
1396
1400
  def eql?(oth)
1397
1401
  self.class == oth.class &&
1398
1402
  parser == oth.parser &&
1399
1403
  self.component_ary.eql?(oth.component_ary)
1400
1404
  end
1401
1405
 
1402
- =begin
1403
-
1404
- --- URI::Generic#===(oth)
1405
-
1406
- =end
1407
- # def ===(oth)
1408
- # raise NotImplementedError
1409
- # end
1410
-
1411
- =begin
1412
- =end
1413
-
1414
-
1415
1406
  # Returns an Array of the components defined from the COMPONENT Array.
1416
1407
  def component_ary
1417
1408
  component.collect do |x|
@@ -1448,7 +1439,7 @@ module URI
1448
1439
  end
1449
1440
  end
1450
1441
 
1451
- def inspect
1442
+ def inspect # :nodoc:
1452
1443
  "#<#{self.class} #{self}>"
1453
1444
  end
1454
1445
 
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)
@@ -321,14 +321,14 @@ module URI
321
321
  str.gsub(escaped) { [$&[1, 2]].pack('H2').force_encoding(enc) }
322
322
  end
323
323
 
324
- @@to_s = Kernel.instance_method(:to_s)
325
- if @@to_s.respond_to?(:bind_call)
326
- def inspect
327
- @@to_s.bind_call(self)
324
+ TO_S = Kernel.instance_method(:to_s) # :nodoc:
325
+ if TO_S.respond_to?(:bind_call)
326
+ def inspect # :nodoc:
327
+ TO_S.bind_call(self)
328
328
  end
329
329
  else
330
- def inspect
331
- @@to_s.bind(self).call
330
+ def inspect # :nodoc:
331
+ TO_S.bind(self).call
332
332
  end
333
333
  end
334
334
 
@@ -536,4 +536,11 @@ module URI
536
536
  end
537
537
 
538
538
  end # class Parser
539
+
540
+ # Backward compatibility for URI::REGEXP::PATTERN::*
541
+ RFC2396_Parser.new.pattern.each_pair do |sym, str|
542
+ unless RFC2396_REGEXP::PATTERN.const_defined?(sym, false)
543
+ RFC2396_REGEXP::PATTERN.const_set(sym, str)
544
+ end
545
+ end
539
546
  end # module URI
@@ -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 obsolete. 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 obsolete. 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 obsolete. 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 obsolete. 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 = '001301'.freeze
3
+ VERSION_CODE = '010003'.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.1
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akira Yamada
8
+ autorequire:
8
9
  bindir: exe
9
10
  cert_chain: []
10
- date: 2024-08-27 00:00:00.000000000 Z
11
+ date: 2025-02-26 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:
@@ -16,16 +17,12 @@ executables: []
16
17
  extensions: []
17
18
  extra_rdoc_files: []
18
19
  files:
19
- - ".github/dependabot.yml"
20
- - ".github/workflows/gh-pages.yml"
21
- - ".github/workflows/test.yml"
22
- - ".gitignore"
23
- - Gemfile
24
- - LICENSE.txt
20
+ - ".document"
21
+ - ".rdoc_options"
22
+ - BSDL
23
+ - COPYING
25
24
  - README.md
26
- - Rakefile
27
- - bin/console
28
- - bin/setup
25
+ - docs/kernel.rb
29
26
  - lib/uri.rb
30
27
  - lib/uri/common.rb
31
28
  - lib/uri/file.rb
@@ -41,8 +38,6 @@ files:
41
38
  - lib/uri/version.rb
42
39
  - lib/uri/ws.rb
43
40
  - lib/uri/wss.rb
44
- - rakelib/sync_tool.rake
45
- - uri.gemspec
46
41
  homepage: https://github.com/ruby/uri
47
42
  licenses:
48
43
  - Ruby
@@ -53,6 +48,7 @@ metadata:
53
48
  documentation_uri: https://ruby.github.io/uri/
54
49
  homepage_uri: https://github.com/ruby/uri
55
50
  source_code_uri: https://github.com/ruby/uri
51
+ post_install_message:
56
52
  rdoc_options: []
57
53
  require_paths:
58
54
  - lib
@@ -67,7 +63,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
63
  - !ruby/object:Gem::Version
68
64
  version: '0'
69
65
  requirements: []
70
- rubygems_version: 3.6.0.dev
66
+ rubygems_version: 3.5.11
67
+ signing_key:
71
68
  specification_version: 4
72
69
  summary: URI is a module providing classes to handle Uniform Resource Identifiers
73
70
  test_files: []
@@ -1,6 +0,0 @@
1
- version: 2
2
- updates:
3
- - package-ecosystem: 'github-actions'
4
- directory: '/'
5
- schedule:
6
- interval: 'weekly'
@@ -1,46 +0,0 @@
1
- name: Deploy RDoc site to Pages
2
-
3
- on:
4
- push:
5
- branches: [ 'master' ]
6
- workflow_dispatch:
7
-
8
- permissions:
9
- contents: read
10
- pages: write
11
- id-token: write
12
-
13
- concurrency:
14
- group: "pages"
15
- cancel-in-progress: true
16
-
17
- jobs:
18
- build:
19
- runs-on: ubuntu-latest
20
- steps:
21
- - name: Checkout
22
- uses: actions/checkout@v4
23
- - name: Setup Ruby
24
- uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0
25
- with:
26
- ruby-version: '3.2'
27
- bundler-cache: true
28
- - name: Setup Pages
29
- id: pages
30
- uses: actions/configure-pages@v3
31
- - name: Build with RDoc
32
- # Outputs to the './_site' directory by default
33
- run: bundle exec rake rdoc
34
- - name: Upload artifact
35
- uses: actions/upload-pages-artifact@v2
36
-
37
- deploy:
38
- environment:
39
- name: github-pages
40
- url: ${{ steps.deployment.outputs.page_url }}
41
- runs-on: ubuntu-latest
42
- needs: build
43
- steps:
44
- - name: Deploy to GitHub Pages
45
- id: deployment
46
- uses: actions/deploy-pages@v2
@@ -1,30 +0,0 @@
1
- name: CI
2
-
3
- on: [push, pull_request]
4
-
5
- jobs:
6
- ruby-versions:
7
- uses: ruby/actions/.github/workflows/ruby_versions.yml@master
8
- with:
9
- min_version: 2.5
10
-
11
- build:
12
- needs: ruby-versions
13
- name: build (${{ matrix.ruby }} / ${{ matrix.os }})
14
- strategy:
15
- matrix:
16
- ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
17
- os: [ ubuntu-latest, macos-latest ]
18
- exclude:
19
- - ruby: 2.5
20
- os: macos-latest
21
- runs-on: ${{ matrix.os }}
22
- steps:
23
- - uses: actions/checkout@v4
24
- - name: Set up Ruby
25
- uses: ruby/setup-ruby@v1
26
- with:
27
- ruby-version: ${{ matrix.ruby }}
28
- - run: bundle install --jobs 4 --retry 3
29
- - name: Run test
30
- run: rake test
data/.gitignore DELETED
@@ -1,10 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
- Gemfile.lock
10
- /_site
data/Gemfile DELETED
@@ -1,10 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gemspec
4
-
5
- group :development do
6
- gem "bundler"
7
- gem "rake"
8
- gem "test-unit"
9
- gem "test-unit-ruby-core"
10
- end
data/Rakefile DELETED
@@ -1,18 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
3
-
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << "test/lib"
6
- t.ruby_opts << "-rhelper"
7
- t.test_files = FileList["test/**/test_*.rb"]
8
- end
9
-
10
- require "rdoc/task"
11
- RDoc::Task.new do |doc|
12
- doc.main = "README.md"
13
- doc.title = "URI - handle Uniform Resource Identifiers"
14
- doc.rdoc_files = FileList.new %w[lib README.md LICENSE.txt]
15
- doc.rdoc_dir = "_site" # for github pages
16
- end
17
-
18
- task :default => :test
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "uri"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,17 +0,0 @@
1
- task :sync_tool, [:from] do |t, from: nil|
2
- from ||= (File.identical?(__dir__, "rakelib") ? "../ruby/tool" : File.dirname(__dir__))
3
-
4
- require 'fileutils'
5
-
6
- {
7
- "rakelib/sync_tool.rake" => "rakelib",
8
- "lib/core_assertions.rb" => "test/lib",
9
- "lib/envutil.rb" => "test/lib",
10
- "lib/find_executable.rb" => "test/lib",
11
- "lib/helper.rb" => "test/lib",
12
- }.each do |src, dest|
13
- FileUtils.mkpath(dest)
14
- FileUtils.cp "#{from}/#{src}", dest
15
- rescue Errno::ENOENT
16
- end
17
- end
data/uri.gemspec DELETED
@@ -1,39 +0,0 @@
1
- begin
2
- require_relative "lib/uri/version"
3
- rescue LoadError # Fallback to load version file in ruby core repository
4
- require_relative "version"
5
- end
6
-
7
- Gem::Specification.new do |spec|
8
- spec.name = "uri"
9
- spec.version = URI::VERSION
10
- spec.authors = ["Akira Yamada"]
11
- spec.email = ["akira@ruby-lang.org"]
12
-
13
- spec.summary = %q{URI is a module providing classes to handle Uniform Resource Identifiers}
14
- spec.description = spec.summary
15
-
16
- github_link = "https://github.com/ruby/uri"
17
-
18
- spec.homepage = github_link
19
- spec.licenses = ["Ruby", "BSD-2-Clause"]
20
-
21
- spec.required_ruby_version = '>= 2.5'
22
-
23
- spec.metadata = {
24
- "bug_tracker_uri" => "#{github_link}/issues",
25
- "changelog_uri" => "#{github_link}/releases",
26
- "documentation_uri" => "https://ruby.github.io/uri/",
27
- "homepage_uri" => spec.homepage,
28
- "source_code_uri" => github_link
29
- }
30
-
31
- # Specify which files should be added to the gem when it is released.
32
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
33
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
34
- `git ls-files -z 2>#{IO::NULL}`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
35
- end
36
- spec.bindir = "exe"
37
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
38
- spec.require_paths = ["lib"]
39
- end