uri 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.document +5 -0
- data/.rdoc_options +4 -0
- data/README.md +1 -1
- data/docs/kernel.rb +2 -0
- data/lib/uri/common.rb +7 -3
- data/lib/uri/generic.rb +30 -16
- data/lib/uri/rfc2396_parser.rb +6 -6
- data/lib/uri/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e61461f9ab7266fd7f7ea9c4d3a172084d8e49d47d67f9f617d7a6b67627f897
|
4
|
+
data.tar.gz: 6a07bdb82eccef17dae4ebfd31962b78cddc92289e35ccca9bfe5cb0b51d7926
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bad82418613236fbc774f4cee778647b2f1ffbc7a3bb0fb6c73b78c1b4ac41688ae8523c7da4963f5a160e894cca4fc1464d2b476b097d43d68ab27b1d44024
|
7
|
+
data.tar.gz: 4dadf1e73a268067905db815098c7e54e12bcf23b72265ec25445873e549fa2404f020f9012811c19fb48b5915ce54b52adda650487af30f33ab6cdf2fed6831
|
data/.rdoc_options
ADDED
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
[](https://github.com/ruby/uri/actions/workflows/test.yml)
|
4
4
|
[](https://ruby.github.io/uri/)
|
5
5
|
|
6
|
-
URI is a module providing classes to handle Uniform Resource Identifiers [
|
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
data/lib/uri/common.rb
CHANGED
@@ -13,15 +13,19 @@ require_relative "rfc2396_parser"
|
|
13
13
|
require_relative "rfc3986_parser"
|
14
14
|
|
15
15
|
module URI
|
16
|
+
# The default parser instance for RFC 2396.
|
16
17
|
RFC2396_PARSER = RFC2396_Parser.new
|
17
18
|
Ractor.make_shareable(RFC2396_PARSER) if defined?(Ractor)
|
18
19
|
|
20
|
+
# The default parser instance for RFC 3986.
|
19
21
|
RFC3986_PARSER = RFC3986_Parser.new
|
20
22
|
Ractor.make_shareable(RFC3986_PARSER) if defined?(Ractor)
|
21
23
|
|
24
|
+
# The default parser instance.
|
22
25
|
DEFAULT_PARSER = RFC3986_PARSER
|
23
26
|
Ractor.make_shareable(DEFAULT_PARSER) if defined?(Ractor)
|
24
27
|
|
28
|
+
# Set the default parser instance.
|
25
29
|
def self.parser=(parser = RFC3986_PARSER)
|
26
30
|
remove_const(:Parser) if defined?(::URI::Parser)
|
27
31
|
const_set("Parser", parser.class)
|
@@ -40,7 +44,7 @@ module URI
|
|
40
44
|
end
|
41
45
|
self.parser = RFC3986_PARSER
|
42
46
|
|
43
|
-
def self.const_missing(const)
|
47
|
+
def self.const_missing(const) # :nodoc:
|
44
48
|
if const == :REGEXP
|
45
49
|
warn "URI::REGEXP is obsolete. Use URI::RFC2396_REGEXP explicitly.", uplevel: 1 if $VERBOSE
|
46
50
|
URI::RFC2396_REGEXP
|
@@ -87,7 +91,7 @@ module URI
|
|
87
91
|
module_function :make_components_hash
|
88
92
|
end
|
89
93
|
|
90
|
-
module Schemes
|
94
|
+
module Schemes # :nodoc:
|
91
95
|
end
|
92
96
|
private_constant :Schemes
|
93
97
|
|
@@ -305,7 +309,7 @@ module URI
|
|
305
309
|
256.times do |i|
|
306
310
|
TBLENCWWWCOMP_[-i.chr] = -('%%%02X' % i)
|
307
311
|
end
|
308
|
-
TBLENCURICOMP_ = TBLENCWWWCOMP_.dup.freeze
|
312
|
+
TBLENCURICOMP_ = TBLENCWWWCOMP_.dup.freeze # :nodoc:
|
309
313
|
TBLENCWWWCOMP_[' '] = '+'
|
310
314
|
TBLENCWWWCOMP_.freeze
|
311
315
|
TBLDECWWWCOMP_ = {} # :nodoc:
|
data/lib/uri/generic.rb
CHANGED
@@ -186,18 +186,18 @@ module URI
|
|
186
186
|
|
187
187
|
if arg_check
|
188
188
|
self.scheme = scheme
|
189
|
-
self.userinfo = userinfo
|
190
189
|
self.hostname = host
|
191
190
|
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)
|
199
198
|
self.set_host(host)
|
200
199
|
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)
|
@@ -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
|
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,
|
525
|
+
set_userinfo(v, nil)
|
526
526
|
v
|
527
527
|
end
|
528
528
|
protected :set_user
|
@@ -574,6 +574,12 @@ 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
|
+
|
577
583
|
# Returns the user component after URI decoding.
|
578
584
|
def decoded_user
|
579
585
|
URI.decode_uri_component(@user) if @user
|
@@ -615,6 +621,13 @@ module URI
|
|
615
621
|
end
|
616
622
|
protected :set_host
|
617
623
|
|
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
|
+
|
618
631
|
#
|
619
632
|
# == Args
|
620
633
|
#
|
@@ -639,6 +652,7 @@ module URI
|
|
639
652
|
def host=(v)
|
640
653
|
check_host(v)
|
641
654
|
set_host(v)
|
655
|
+
set_userinfo(nil)
|
642
656
|
v
|
643
657
|
end
|
644
658
|
|
@@ -729,6 +743,7 @@ module URI
|
|
729
743
|
def port=(v)
|
730
744
|
check_port(v)
|
731
745
|
set_port(v)
|
746
|
+
set_userinfo(nil)
|
732
747
|
port
|
733
748
|
end
|
734
749
|
|
@@ -737,12 +752,12 @@ module URI
|
|
737
752
|
end
|
738
753
|
private :check_registry
|
739
754
|
|
740
|
-
def set_registry(v)
|
755
|
+
def set_registry(v) # :nodoc:
|
741
756
|
raise InvalidURIError, "cannot set registry"
|
742
757
|
end
|
743
758
|
protected :set_registry
|
744
759
|
|
745
|
-
def registry=(v)
|
760
|
+
def registry=(v) # :nodoc:
|
746
761
|
raise InvalidURIError, "cannot set registry"
|
747
762
|
end
|
748
763
|
|
@@ -1121,7 +1136,7 @@ module URI
|
|
1121
1136
|
|
1122
1137
|
base = self.dup
|
1123
1138
|
|
1124
|
-
authority = rel.
|
1139
|
+
authority = rel.authority
|
1125
1140
|
|
1126
1141
|
# RFC2396, Section 5.2, 2)
|
1127
1142
|
if (rel.path.nil? || rel.path.empty?) && !authority && !rel.query
|
@@ -1133,17 +1148,14 @@ module URI
|
|
1133
1148
|
base.fragment=(nil)
|
1134
1149
|
|
1135
1150
|
# RFC2396, Section 5.2, 4)
|
1136
|
-
if
|
1137
|
-
base.
|
1138
|
-
|
1139
|
-
|
1140
|
-
base.set_path(
|
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))
|
1141
1156
|
end
|
1142
1157
|
|
1143
1158
|
# 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
1159
|
base.query = rel.query if rel.query
|
1148
1160
|
base.fragment=(rel.fragment) if rel.fragment
|
1149
1161
|
|
@@ -1392,10 +1404,12 @@ module URI
|
|
1392
1404
|
end
|
1393
1405
|
end
|
1394
1406
|
|
1407
|
+
# Returns the hash value.
|
1395
1408
|
def hash
|
1396
1409
|
self.component_ary.hash
|
1397
1410
|
end
|
1398
1411
|
|
1412
|
+
# Compares with _oth_ for Hash.
|
1399
1413
|
def eql?(oth)
|
1400
1414
|
self.class == oth.class &&
|
1401
1415
|
parser == oth.parser &&
|
@@ -1438,7 +1452,7 @@ module URI
|
|
1438
1452
|
end
|
1439
1453
|
end
|
1440
1454
|
|
1441
|
-
def inspect
|
1455
|
+
def inspect # :nodoc:
|
1442
1456
|
"#<#{self.class} #{self}>"
|
1443
1457
|
end
|
1444
1458
|
|
data/lib/uri/rfc2396_parser.rb
CHANGED
@@ -321,14 +321,14 @@ module URI
|
|
321
321
|
str.gsub(escaped) { [$&[1, 2]].pack('H2').force_encoding(enc) }
|
322
322
|
end
|
323
323
|
|
324
|
-
|
325
|
-
if
|
326
|
-
def inspect
|
327
|
-
|
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
|
-
|
330
|
+
def inspect # :nodoc:
|
331
|
+
TO_S.bind(self).call
|
332
332
|
end
|
333
333
|
end
|
334
334
|
|
data/lib/uri/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uri
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akira Yamada
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies: []
|
13
12
|
description: URI is a module providing classes to handle Uniform Resource Identifiers
|
14
13
|
email:
|
@@ -17,9 +16,12 @@ executables: []
|
|
17
16
|
extensions: []
|
18
17
|
extra_rdoc_files: []
|
19
18
|
files:
|
19
|
+
- ".document"
|
20
|
+
- ".rdoc_options"
|
20
21
|
- BSDL
|
21
22
|
- COPYING
|
22
23
|
- README.md
|
24
|
+
- docs/kernel.rb
|
23
25
|
- lib/uri.rb
|
24
26
|
- lib/uri/common.rb
|
25
27
|
- lib/uri/file.rb
|
@@ -45,7 +47,6 @@ metadata:
|
|
45
47
|
documentation_uri: https://ruby.github.io/uri/
|
46
48
|
homepage_uri: https://github.com/ruby/uri
|
47
49
|
source_code_uri: https://github.com/ruby/uri
|
48
|
-
post_install_message:
|
49
50
|
rdoc_options: []
|
50
51
|
require_paths:
|
51
52
|
- lib
|
@@ -60,8 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
61
|
- !ruby/object:Gem::Version
|
61
62
|
version: '0'
|
62
63
|
requirements: []
|
63
|
-
rubygems_version: 3.
|
64
|
-
signing_key:
|
64
|
+
rubygems_version: 3.8.0.dev
|
65
65
|
specification_version: 4
|
66
66
|
summary: URI is a module providing classes to handle Uniform Resource Identifiers
|
67
67
|
test_files: []
|