uri 0.12.3 → 0.12.5
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/lib/uri/generic.rb +25 -13
- data/lib/uri/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 522757d2dcaf03c71cf264ebe70ebc52977e41f0ebdfd571736e75bd68bf8b06
|
4
|
+
data.tar.gz: 2b95b950a4c1b64ba908f5bc2faf33994ceabf74a7b00b90df8d1535b77487a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28e9ddf4e9c71eb4e92ceef3cdcf3119b11f722197f39157fa61df13de44d967a4694ee87e6ad0a4d21e0047f12818473914000ebc5d96810dec55544e157b6b
|
7
|
+
data.tar.gz: cb098d2164e1dbf3e310ff11fcd9428a1beec85dbcca9b116b2dba7ba0408a82af4a71b5240dfa0a6498bf747360accd7d03d4a89dcb7c2842139430301e4839
|
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
|
|
@@ -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
|
|
data/lib/uri/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uri
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akira Yamada
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies: []
|
12
12
|
description: URI is a module providing classes to handle Uniform Resource Identifiers
|
13
13
|
email:
|
@@ -62,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: '0'
|
64
64
|
requirements: []
|
65
|
-
rubygems_version: 3.
|
65
|
+
rubygems_version: 3.8.0.dev
|
66
66
|
specification_version: 4
|
67
67
|
summary: URI is a module providing classes to handle Uniform Resource Identifiers
|
68
68
|
test_files: []
|