uri 0.12.4 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5c43a663680279fb560cd1743d6ddd5c8d856b938381b16c525ca467ca4f53d8
4
- data.tar.gz: 41bf92949944caad1719afe0b2067d5889104430e938e84e183cfd81e2a048c7
3
+ metadata.gz: 522757d2dcaf03c71cf264ebe70ebc52977e41f0ebdfd571736e75bd68bf8b06
4
+ data.tar.gz: 2b95b950a4c1b64ba908f5bc2faf33994ceabf74a7b00b90df8d1535b77487a1
5
5
  SHA512:
6
- metadata.gz: '08c726bbfda93cdeeb7236715ca3c81dfcdaa54dc14084ddd1b61802f819311461973f79845ce410d2e2024ee06ea3921afc5fad3d4323afd9006d5ee2311a06'
7
- data.tar.gz: 60ecac2ccad60019655d96623870256441f8683377ba7f014ea4a6198e3ab9d8387d4a031a1b6e1438cbedcd8f3acd4443b4c48a15c03174fb768aecf4170295
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 if 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, @password)
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.userinfo || rel.host || rel.port
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
@@ -1134,9 +1149,7 @@ module URI
1134
1149
 
1135
1150
  # RFC2396, Section 5.2, 4)
1136
1151
  if authority
1137
- base.set_userinfo(rel.userinfo)
1138
- base.set_host(rel.host)
1139
- base.set_port(rel.port || base.default_port)
1152
+ base.set_authority(*authority)
1140
1153
  base.set_path(rel.path)
1141
1154
  elsif base.path && rel.path
1142
1155
  base.set_path(merge_path(base.path, rel.path))
data/lib/uri/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module URI
2
2
  # :stopdoc:
3
- VERSION_CODE = '001204'.freeze
3
+ VERSION_CODE = '001205'.freeze
4
4
  VERSION = VERSION_CODE.scan(/../).collect{|n| n.to_i}.join('.').freeze
5
5
  # :startdoc:
6
6
  end
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: 0.12.4
4
+ version: 0.12.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akira Yamada
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-02-26 00:00:00.000000000 Z
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:
@@ -49,7 +48,6 @@ licenses:
49
48
  metadata:
50
49
  homepage_uri: https://github.com/ruby/uri
51
50
  source_code_uri: https://github.com/ruby/uri
52
- post_install_message:
53
51
  rdoc_options: []
54
52
  require_paths:
55
53
  - lib
@@ -64,8 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
62
  - !ruby/object:Gem::Version
65
63
  version: '0'
66
64
  requirements: []
67
- rubygems_version: 3.4.19
68
- signing_key:
65
+ rubygems_version: 3.8.0.dev
69
66
  specification_version: 4
70
67
  summary: URI is a module providing classes to handle Uniform Resource Identifiers
71
68
  test_files: []