uri 0.12.2 → 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.
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 << '?'
@@ -1376,6 +1378,7 @@ module URI
1376
1378
  end
1377
1379
  str
1378
1380
  end
1381
+ alias to_str to_s
1379
1382
 
1380
1383
  #
1381
1384
  # Compares two URIs.
@@ -1388,29 +1391,18 @@ module URI
1388
1391
  end
1389
1392
  end
1390
1393
 
1394
+ # Returns the hash value.
1391
1395
  def hash
1392
1396
  self.component_ary.hash
1393
1397
  end
1394
1398
 
1399
+ # Compares with _oth_ for Hash.
1395
1400
  def eql?(oth)
1396
1401
  self.class == oth.class &&
1397
1402
  parser == oth.parser &&
1398
1403
  self.component_ary.eql?(oth.component_ary)
1399
1404
  end
1400
1405
 
1401
- =begin
1402
-
1403
- --- URI::Generic#===(oth)
1404
-
1405
- =end
1406
- # def ===(oth)
1407
- # raise NotImplementedError
1408
- # end
1409
-
1410
- =begin
1411
- =end
1412
-
1413
-
1414
1406
  # Returns an Array of the components defined from the COMPONENT Array.
1415
1407
  def component_ary
1416
1408
  component.collect do |x|
@@ -1447,7 +1439,7 @@ module URI
1447
1439
  end
1448
1440
  end
1449
1441
 
1450
- def inspect
1442
+ def inspect # :nodoc:
1451
1443
  "#<#{self.class} #{self}>"
1452
1444
  end
1453
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
@@ -1,9 +1,73 @@
1
- # frozen_string_literal: false
1
+ # frozen_string_literal: true
2
2
  module URI
3
3
  class RFC3986_Parser # :nodoc:
4
4
  # URI defined in RFC3986
5
- 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/
6
- 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/
5
+ HOST = %r[
6
+ (?<IP-literal>\[(?:
7
+ (?<IPv6address>
8
+ (?:\h{1,4}:){6}
9
+ (?<ls32>\h{1,4}:\h{1,4}
10
+ | (?<IPv4address>(?<dec-octet>[1-9]\d|1\d{2}|2[0-4]\d|25[0-5]|\d)
11
+ \.\g<dec-octet>\.\g<dec-octet>\.\g<dec-octet>)
12
+ )
13
+ | ::(?:\h{1,4}:){5}\g<ls32>
14
+ | \h{1,4}?::(?:\h{1,4}:){4}\g<ls32>
15
+ | (?:(?:\h{1,4}:)?\h{1,4})?::(?:\h{1,4}:){3}\g<ls32>
16
+ | (?:(?:\h{1,4}:){,2}\h{1,4})?::(?:\h{1,4}:){2}\g<ls32>
17
+ | (?:(?:\h{1,4}:){,3}\h{1,4})?::\h{1,4}:\g<ls32>
18
+ | (?:(?:\h{1,4}:){,4}\h{1,4})?::\g<ls32>
19
+ | (?:(?:\h{1,4}:){,5}\h{1,4})?::\h{1,4}
20
+ | (?:(?:\h{1,4}:){,6}\h{1,4})?::
21
+ )
22
+ | (?<IPvFuture>v\h++\.[!$&-.0-9:;=A-Z_a-z~]++)
23
+ )\])
24
+ | \g<IPv4address>
25
+ | (?<reg-name>(?:%\h\h|[!$&-.0-9;=A-Z_a-z~])*+)
26
+ ]x
27
+
28
+ USERINFO = /(?:%\h\h|[!$&-.0-9:;=A-Z_a-z~])*+/
29
+
30
+ SCHEME = %r[[A-Za-z][+\-.0-9A-Za-z]*+].source
31
+ SEG = %r[(?:%\h\h|[!$&-.0-9:;=@A-Z_a-z~/])].source
32
+ SEG_NC = %r[(?:%\h\h|[!$&-.0-9;=@A-Z_a-z~])].source
33
+ FRAGMENT = %r[(?:%\h\h|[!$&-.0-9:;=@A-Z_a-z~/?])*+].source
34
+
35
+ RFC3986_URI = %r[\A
36
+ (?<seg>#{SEG}){0}
37
+ (?<URI>
38
+ (?<scheme>#{SCHEME}):
39
+ (?<hier-part>//
40
+ (?<authority>
41
+ (?:(?<userinfo>#{USERINFO.source})@)?
42
+ (?<host>#{HOST.source.delete(" \n")})
43
+ (?::(?<port>\d*+))?
44
+ )
45
+ (?<path-abempty>(?:/\g<seg>*+)?)
46
+ | (?<path-absolute>/((?!/)\g<seg>++)?)
47
+ | (?<path-rootless>(?!/)\g<seg>++)
48
+ | (?<path-empty>)
49
+ )
50
+ (?:\?(?<query>[^\#]*+))?
51
+ (?:\#(?<fragment>#{FRAGMENT}))?
52
+ )\z]x
53
+
54
+ RFC3986_relative_ref = %r[\A
55
+ (?<seg>#{SEG}){0}
56
+ (?<relative-ref>
57
+ (?<relative-part>//
58
+ (?<authority>
59
+ (?:(?<userinfo>#{USERINFO.source})@)?
60
+ (?<host>#{HOST.source.delete(" \n")}(?<!/))?
61
+ (?::(?<port>\d*+))?
62
+ )
63
+ (?<path-abempty>(?:/\g<seg>*+)?)
64
+ | (?<path-absolute>/\g<seg>*+)
65
+ | (?<path-noscheme>#{SEG_NC}++(?:/\g<seg>*+)?)
66
+ | (?<path-empty>)
67
+ )
68
+ (?:\?(?<query>[^#]*+))?
69
+ (?:\#(?<fragment>#{FRAGMENT}))?
70
+ )\z]x
7
71
  attr_reader :regexp
8
72
 
9
73
  def initialize
@@ -14,14 +78,14 @@ module URI
14
78
  begin
15
79
  uri = uri.to_str
16
80
  rescue NoMethodError
17
- raise InvalidURIError, "bad URI(is not URI?): #{uri.inspect}"
81
+ raise InvalidURIError, "bad URI (is not URI?): #{uri.inspect}"
18
82
  end
19
83
  uri.ascii_only? or
20
84
  raise InvalidURIError, "URI must be ascii only #{uri.dump}"
21
85
  if m = RFC3986_URI.match(uri)
22
- query = m["query".freeze]
23
- scheme = m["scheme".freeze]
24
- opaque = m["path-rootless".freeze]
86
+ query = m["query"]
87
+ scheme = m["scheme"]
88
+ opaque = m["path-rootless"]
25
89
  if opaque
26
90
  opaque << "?#{query}" if query
27
91
  [ scheme,
@@ -32,38 +96,38 @@ module URI
32
96
  nil, # path
33
97
  opaque,
34
98
  nil, # query
35
- m["fragment".freeze]
99
+ m["fragment"]
36
100
  ]
37
101
  else # normal
38
102
  [ scheme,
39
- m["userinfo".freeze],
40
- m["host".freeze],
41
- m["port".freeze],
103
+ m["userinfo"],
104
+ m["host"],
105
+ m["port"],
42
106
  nil, # registry
43
- (m["path-abempty".freeze] ||
44
- m["path-absolute".freeze] ||
45
- m["path-empty".freeze]),
107
+ (m["path-abempty"] ||
108
+ m["path-absolute"] ||
109
+ m["path-empty"]),
46
110
  nil, # opaque
47
111
  query,
48
- m["fragment".freeze]
112
+ m["fragment"]
49
113
  ]
50
114
  end
51
115
  elsif m = RFC3986_relative_ref.match(uri)
52
116
  [ nil, # scheme
53
- m["userinfo".freeze],
54
- m["host".freeze],
55
- m["port".freeze],
117
+ m["userinfo"],
118
+ m["host"],
119
+ m["port"],
56
120
  nil, # registry,
57
- (m["path-abempty".freeze] ||
58
- m["path-absolute".freeze] ||
59
- m["path-noscheme".freeze] ||
60
- m["path-empty".freeze]),
121
+ (m["path-abempty"] ||
122
+ m["path-absolute"] ||
123
+ m["path-noscheme"] ||
124
+ m["path-empty"]),
61
125
  nil, # opaque
62
- m["query".freeze],
63
- m["fragment".freeze]
126
+ m["query"],
127
+ m["fragment"]
64
128
  ]
65
129
  else
66
- raise InvalidURIError, "bad URI(is not URI?): #{uri.inspect}"
130
+ raise InvalidURIError, "bad URI (is not URI?): #{uri.inspect}"
67
131
  end
68
132
  end
69
133
 
@@ -71,12 +135,35 @@ module URI
71
135
  URI.for(*self.split(uri), self)
72
136
  end
73
137
 
74
-
75
138
  def join(*uris) # :nodoc:
76
139
  uris[0] = convert_to_uri(uris[0])
77
140
  uris.inject :merge
78
141
  end
79
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
+
80
167
  @@to_s = Kernel.instance_method(:to_s)
81
168
  if @@to_s.respond_to?(:bind_call)
82
169
  def inspect
@@ -92,14 +179,14 @@ module URI
92
179
 
93
180
  def default_regexp # :nodoc:
94
181
  {
95
- SCHEME: /\A[A-Za-z][A-Za-z0-9+\-.]*\z/,
96
- USERINFO: /\A(?:%\h\h|[!$&-.0-;=A-Z_a-z~])*\z/,
97
- HOST: /\A(?:(?<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{,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~])*))\z/,
98
- ABS_PATH: /\A\/(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*(?:\/(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*)*\z/,
99
- REL_PATH: /\A(?:%\h\h|[!$&-.0-;=@-Z_a-z~])+(?:\/(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*)*\z/,
100
- QUERY: /\A(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*\z/,
101
- FRAGMENT: /\A(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*\z/,
102
- OPAQUE: /\A(?:[^\/].*)?\z/,
182
+ SCHEME: %r[\A#{SCHEME}\z]o,
183
+ USERINFO: %r[\A#{USERINFO}\z]o,
184
+ HOST: %r[\A#{HOST}\z]o,
185
+ ABS_PATH: %r[\A/#{SEG}*+\z]o,
186
+ REL_PATH: %r[\A(?!/)#{SEG}++\z]o,
187
+ QUERY: %r[\A(?:%\h\h|[!$&-.0-9:;=@A-Z_a-z~/?])*+\z],
188
+ FRAGMENT: %r[\A#{FRAGMENT}\z]o,
189
+ OPAQUE: %r[\A(?:[^/].*)?\z],
103
190
  PORT: /\A[\x09\x0a\x0c\x0d ]*+\d*[\x09\x0a\x0c\x0d ]*\z/,
104
191
  }
105
192
  end
data/lib/uri/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module URI
2
2
  # :stopdoc:
3
- VERSION_CODE = '001202'.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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uri
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akira Yamada
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-29 00:00:00.000000000 Z
11
+ date: 2025-02-26 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,15 +17,12 @@ executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
- - ".github/dependabot.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,12 +38,14 @@ files:
41
38
  - lib/uri/version.rb
42
39
  - lib/uri/ws.rb
43
40
  - lib/uri/wss.rb
44
- - uri.gemspec
45
41
  homepage: https://github.com/ruby/uri
46
42
  licenses:
47
43
  - Ruby
48
44
  - BSD-2-Clause
49
45
  metadata:
46
+ bug_tracker_uri: https://github.com/ruby/uri/issues
47
+ changelog_uri: https://github.com/ruby/uri/releases
48
+ documentation_uri: https://ruby.github.io/uri/
50
49
  homepage_uri: https://github.com/ruby/uri
51
50
  source_code_uri: https://github.com/ruby/uri
52
51
  post_install_message:
@@ -57,14 +56,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
57
56
  requirements:
58
57
  - - ">="
59
58
  - !ruby/object:Gem::Version
60
- version: '2.4'
59
+ version: '2.5'
61
60
  required_rubygems_version: !ruby/object:Gem::Requirement
62
61
  requirements:
63
62
  - - ">="
64
63
  - !ruby/object:Gem::Version
65
64
  version: '0'
66
65
  requirements: []
67
- rubygems_version: 3.3.26
66
+ rubygems_version: 3.5.11
68
67
  signing_key:
69
68
  specification_version: 4
70
69
  summary: URI is a module providing classes to handle Uniform Resource Identifiers
@@ -1,6 +0,0 @@
1
- version: 2
2
- updates:
3
- - package-ecosystem: 'github-actions'
4
- directory: '/'
5
- schedule:
6
- interval: 'weekly'
@@ -1,21 +0,0 @@
1
- name: CI
2
-
3
- on: [push, pull_request]
4
-
5
- jobs:
6
- build:
7
- name: build (${{ matrix.ruby }} / ${{ matrix.os }})
8
- strategy:
9
- matrix:
10
- ruby: [ 3.1, '3.0', 2.7, 2.6, 2.5, 2.4, head, truffleruby ]
11
- os: [ ubuntu-latest, macos-latest ]
12
- runs-on: ${{ matrix.os }}
13
- steps:
14
- - uses: actions/checkout@v3
15
- - name: Set up Ruby
16
- uses: ruby/setup-ruby@v1
17
- with:
18
- ruby-version: ${{ matrix.ruby }}
19
- - run: bundle install --jobs 4 --retry 3
20
- - name: Run test
21
- run: rake test
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
- Gemfile.lock
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,17 +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
- 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
- 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__)