addressable 2.9.1 → 2.9.2
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/CHANGELOG.md +31 -0
- data/lib/addressable/idna/native.rb +4 -2
- data/lib/addressable/idna/pure.rb +93 -91
- data/lib/addressable/template.rb +8 -8
- data/lib/addressable/uri.rb +27 -8
- data/lib/addressable/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: 322c647045515735a4adbd9c7681c7ab0c29b0cf1df4b9893ec5eb7a4c357bba
|
|
4
|
+
data.tar.gz: 1ddb9d2653a52dc98833f1ff28a849102619c16c752a92b8a6f3a6f1d67ab7c1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 360a539e633029a58bad0b5173fdaee569c40f2d399dc51254f450dc4cf09f0b1805b2cad7033fd56ade0bf698376dc3be1b737ce0fa19f54a7a11ed6c3cfb0c
|
|
7
|
+
data.tar.gz: 9ee58aee4c18fb18a1516ac3bb3c85c1bc75804a8720f1719fb1fc66895b0fbaf84bd689b83ec850a52693c3976532bd94a13bdbf7f97fc5c583b2f2cb0d847d
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Addressable 2.9.2 <a name="v2.9.2">
|
|
4
|
+
- fixes `Addressable::URI` returning stale values after a component was
|
|
5
|
+
changed: e.g. after `host=`, `#site`, `#normalized_site`,
|
|
6
|
+
`#normalized_authority` and `#normalize` could still use the old host, and
|
|
7
|
+
after `scheme=`, `#normalized_port` could keep a port that's the new
|
|
8
|
+
scheme's default (#613)
|
|
9
|
+
- fixes `Addressable::URI#normalized_query` reusing the result of an earlier
|
|
10
|
+
call with different flags: e.g. after `normalized_query(:sorted)`,
|
|
11
|
+
`normalized_query` and `#normalize` gave a sorted query, and after
|
|
12
|
+
`normalized_query`, `normalized_query(:sorted)` gave an unsorted one (#608)
|
|
13
|
+
- fixes `Addressable::Template#expand` and `#partial_expand` changing the
|
|
14
|
+
arrays given as values: e.g. `[1, :a]` became `["1", "a"]`; a frozen array
|
|
15
|
+
raised `FrozenError`, and an object that responds to `to_ary`
|
|
16
|
+
raised `TypeError` (#605)
|
|
17
|
+
- fixes `Addressable::URI#clone` sharing component strings with the original:
|
|
18
|
+
e.g. appending to the clone's `#host` also changed the original's host, but
|
|
19
|
+
not its cached normalized values; `#dup` already made a separate copy (#617)
|
|
20
|
+
- fixes the pure-Ruby `Addressable::IDNA.to_unicode` raising `ZeroDivisionError`
|
|
21
|
+
on some malformed labels, e.g. `xn--rp3=`, which also made
|
|
22
|
+
`Addressable::URI#display_uri` raise, because the Punycode decoder
|
|
23
|
+
treated punctuation as digits; such labels are now returned unchanged (#614)
|
|
24
|
+
- speeds up the pure-Ruby `Addressable::IDNA.to_unicode`, which became up to
|
|
25
|
+
25 times slower in 2.9.1 on long labels with many non-ASCII characters;
|
|
26
|
+
Punycode encoding no longer takes quadratic time (#645)
|
|
27
|
+
- fixes the "character class has duplicated range" warnings that 2.9.1 gave
|
|
28
|
+
when `Addressable::IDNA` was loaded with warnings enabled
|
|
29
|
+
- fixes the "instance variable @validation_deferred not initialized" warning
|
|
30
|
+
that 2.9.1 gave for every new `Addressable::URI` on Ruby before 3.0 with
|
|
31
|
+
warnings enabled, and a "shadowing outer local variable" warning from
|
|
32
|
+
`Addressable::Template` on Ruby 2.4 and 2.5
|
|
33
|
+
|
|
3
34
|
## Addressable 2.9.1 <a name="v2.9.1">
|
|
4
35
|
- fixes denial of service in `Addressable::URI.normalize_path`, which took
|
|
5
36
|
quadratic time on paths with many dot segments; `URI#normalize`, `#join`,
|
|
@@ -55,8 +55,10 @@ module Addressable
|
|
|
55
55
|
# themselves: controls, format characters such as bidi overrides and
|
|
56
56
|
# isolates, and default ignorable code points. libidn rejects most of
|
|
57
57
|
# them, but not those added to Unicode after the version it checks
|
|
58
|
-
# against, such as U+2066 to U+2069.
|
|
59
|
-
|
|
58
|
+
# against, such as U+2066 to U+2069. Format characters that are also
|
|
59
|
+
# default ignorable are left out of the second set, since Ruby warns about
|
|
60
|
+
# a duplicated range in a character class.
|
|
61
|
+
DISPLAY_CHANGING = /[\p{Cc}\p{Cf}[\p{Default_Ignorable_Code_Point}&&\P{Cf}]]/
|
|
60
62
|
|
|
61
63
|
def self.to_unicode(value)
|
|
62
64
|
value.to_s.split('.', -1).map do |segment|
|
|
@@ -57,7 +57,9 @@ module Addressable
|
|
|
57
57
|
|
|
58
58
|
# Characters that nameprep doesn't allow in a label (Section 5 of
|
|
59
59
|
# RFC 3491), or that it maps to nothing, so they can't be in a label that
|
|
60
|
-
# toASCII produces.
|
|
60
|
+
# toASCII produces. Some code points are in more than one table; they're
|
|
61
|
+
# listed only under the first, since Ruby warns about a duplicated range
|
|
62
|
+
# in a character class.
|
|
61
63
|
NAMEPREP_PROHIBITED = Regexp.new("[" + [
|
|
62
64
|
# Table C.1.2, non-ASCII space characters
|
|
63
65
|
"\u00A0\u1680\u2000-\u200B\u202F\u205F\u3000",
|
|
@@ -70,23 +72,27 @@ module Addressable
|
|
|
70
72
|
"\uFDD0-\uFDEF" + (0..16).map do |plane|
|
|
71
73
|
[plane * 0x10000 + 0xFFFE, 0x2D, plane * 0x10000 + 0xFFFF].pack("U*")
|
|
72
74
|
end.join,
|
|
73
|
-
# Table C.6, inappropriate for plain text
|
|
74
|
-
"\
|
|
75
|
+
# Table C.6, inappropriate for plain text (U+FFF9 to U+FFFC are in C.2.2)
|
|
76
|
+
"\uFFFD",
|
|
75
77
|
# Table C.7, inappropriate for canonical representation
|
|
76
78
|
"\u2FF0-\u2FFB",
|
|
77
|
-
# Table C.8, change display properties or are deprecated
|
|
78
|
-
|
|
79
|
+
# Table C.8, change display properties or are deprecated (U+206A to
|
|
80
|
+
# U+206F are in C.2.2)
|
|
81
|
+
"\u0340\u0341\u200E\u200F\u202A-\u202E",
|
|
79
82
|
# Table C.9, tagging characters
|
|
80
83
|
"\u{E0001}\u{E0020}-\u{E007F}",
|
|
81
|
-
# Table B.1, commonly mapped to nothing
|
|
82
|
-
|
|
84
|
+
# Table B.1, commonly mapped to nothing (U+200B is in C.1.2, and U+200C,
|
|
85
|
+
# U+200D, U+2060 and U+FEFF are in C.2.2)
|
|
86
|
+
"\u00AD\u034F\u1806\u180B-\u180D\uFE00-\uFE0F"
|
|
83
87
|
].join + "]")
|
|
84
88
|
|
|
85
89
|
# Characters that change how a label displays without being visible
|
|
86
90
|
# themselves: controls, format characters such as bidi overrides and
|
|
87
91
|
# isolates, and default ignorable code points, including those added to
|
|
88
|
-
# Unicode after the version nameprep is based on.
|
|
89
|
-
|
|
92
|
+
# Unicode after the version nameprep is based on. Format characters that
|
|
93
|
+
# are also default ignorable are left out of the second set, since Ruby
|
|
94
|
+
# warns about a duplicated range in a character class.
|
|
95
|
+
DISPLAY_CHANGING = /[\p{Cc}\p{Cf}[\p{Default_Ignorable_Code_Point}&&\P{Cf}]]/
|
|
90
96
|
|
|
91
97
|
# :startdoc:
|
|
92
98
|
|
|
@@ -4465,50 +4471,50 @@ module Addressable
|
|
|
4465
4471
|
def self.punycode_encode(unicode)
|
|
4466
4472
|
unicode = unicode.to_s unless unicode.is_a?(String)
|
|
4467
4473
|
input = unicode.unpack("U*")
|
|
4468
|
-
output = [
|
|
4469
|
-
|
|
4470
|
-
output_length = [ACE_MAX_LENGTH]
|
|
4474
|
+
output = []
|
|
4475
|
+
max_out = ACE_MAX_LENGTH
|
|
4471
4476
|
|
|
4472
|
-
#
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
+
# The positions of each non-basic code point, and a Fenwick tree of
|
|
4478
|
+
# the positions of the code points handled so far, so that counting
|
|
4479
|
+
# the handled code points before a position doesn't take a pass over
|
|
4480
|
+
# the input.
|
|
4481
|
+
positions = {}
|
|
4482
|
+
handled = Array.new(input.size + 1, 0)
|
|
4477
4483
|
|
|
4478
4484
|
# Handle the basic code points:
|
|
4479
|
-
|
|
4480
|
-
if punycode_basic?(
|
|
4481
|
-
if max_out -
|
|
4485
|
+
input.each_with_index do |codepoint, j|
|
|
4486
|
+
if punycode_basic?(codepoint)
|
|
4487
|
+
if max_out - output.size < 2
|
|
4482
4488
|
raise PunycodeBigOutput,
|
|
4483
4489
|
"Output would exceed the space provided."
|
|
4484
4490
|
end
|
|
4485
|
-
output
|
|
4486
|
-
|
|
4491
|
+
output << codepoint
|
|
4492
|
+
handled[j + 1] = 1
|
|
4493
|
+
else
|
|
4494
|
+
(positions[codepoint] ||= []) << j
|
|
4487
4495
|
end
|
|
4488
4496
|
end
|
|
4497
|
+
(1..input.size).each do |i|
|
|
4498
|
+
parent = i + (i & -i)
|
|
4499
|
+
handled[parent] += handled[i] if parent <= input.size
|
|
4500
|
+
end
|
|
4489
4501
|
|
|
4490
|
-
h = b =
|
|
4502
|
+
h = b = output.size
|
|
4491
4503
|
|
|
4492
4504
|
# h is the number of code points that have been handled, b is the
|
|
4493
|
-
# number of basic code points, and
|
|
4494
|
-
# that have been output.
|
|
4495
|
-
|
|
4496
|
-
if b > 0
|
|
4497
|
-
output[out] = PUNYCODE_DELIMITER
|
|
4498
|
-
out += 1
|
|
4499
|
-
end
|
|
4505
|
+
# number of basic code points, and output.size is the number of
|
|
4506
|
+
# characters that have been output.
|
|
4500
4507
|
|
|
4501
|
-
|
|
4508
|
+
output << PUNYCODE_DELIMITER if b > 0
|
|
4502
4509
|
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
# handled already. Find the next larger one:
|
|
4510
|
+
# Main encoding loop: handle each non-basic code point in ascending
|
|
4511
|
+
# order.
|
|
4506
4512
|
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
end
|
|
4513
|
+
n = PUNYCODE_INITIAL_N
|
|
4514
|
+
delta = 0
|
|
4515
|
+
bias = PUNYCODE_INITIAL_BIAS
|
|
4511
4516
|
|
|
4517
|
+
positions.keys.sort.each do |m|
|
|
4512
4518
|
# Increase delta enough to advance the decoder's
|
|
4513
4519
|
# <n,i> state to <m,0>, but guard against overflow:
|
|
4514
4520
|
|
|
@@ -4518,47 +4524,56 @@ module Addressable
|
|
|
4518
4524
|
delta += (m - n) * (h + 1)
|
|
4519
4525
|
n = m
|
|
4520
4526
|
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4527
|
+
# Each occurrence of n adds the handled code points since the last
|
|
4528
|
+
# one, which RFC 3492 counts as code points less than n.
|
|
4529
|
+
handled_before_pass = h
|
|
4530
|
+
counted = 0
|
|
4531
|
+
positions[n].each do |position|
|
|
4532
|
+
before = 0
|
|
4533
|
+
i = position
|
|
4534
|
+
while i > 0
|
|
4535
|
+
before += handled[i]
|
|
4536
|
+
i -= i & -i
|
|
4529
4537
|
end
|
|
4538
|
+
delta += before - counted
|
|
4539
|
+
counted = before
|
|
4530
4540
|
|
|
4531
|
-
|
|
4532
|
-
# Represent delta as a generalized variable-length integer:
|
|
4541
|
+
# Represent delta as a generalized variable-length integer:
|
|
4533
4542
|
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
end
|
|
4540
|
-
t = (
|
|
4541
|
-
if k <= bias
|
|
4542
|
-
PUNYCODE_TMIN
|
|
4543
|
-
elsif k >= bias + PUNYCODE_TMAX
|
|
4544
|
-
PUNYCODE_TMAX
|
|
4545
|
-
else
|
|
4546
|
-
k - bias
|
|
4547
|
-
end
|
|
4548
|
-
)
|
|
4549
|
-
break if q < t
|
|
4550
|
-
output[out] =
|
|
4551
|
-
punycode_encode_digit(t + (q - t) % (PUNYCODE_BASE - t))
|
|
4552
|
-
out += 1
|
|
4553
|
-
q = (q - t) / (PUNYCODE_BASE - t)
|
|
4554
|
-
k += PUNYCODE_BASE
|
|
4543
|
+
q = delta; k = PUNYCODE_BASE
|
|
4544
|
+
while true
|
|
4545
|
+
if output.size >= max_out
|
|
4546
|
+
raise PunycodeBigOutput,
|
|
4547
|
+
"Output would exceed the space provided."
|
|
4555
4548
|
end
|
|
4549
|
+
t = (
|
|
4550
|
+
if k <= bias
|
|
4551
|
+
PUNYCODE_TMIN
|
|
4552
|
+
elsif k >= bias + PUNYCODE_TMAX
|
|
4553
|
+
PUNYCODE_TMAX
|
|
4554
|
+
else
|
|
4555
|
+
k - bias
|
|
4556
|
+
end
|
|
4557
|
+
)
|
|
4558
|
+
break if q < t
|
|
4559
|
+
output <<
|
|
4560
|
+
punycode_encode_digit(t + (q - t) % (PUNYCODE_BASE - t))
|
|
4561
|
+
q = (q - t) / (PUNYCODE_BASE - t)
|
|
4562
|
+
k += PUNYCODE_BASE
|
|
4563
|
+
end
|
|
4556
4564
|
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4565
|
+
output << punycode_encode_digit(q)
|
|
4566
|
+
bias = punycode_adapt(delta, h + 1, h == b)
|
|
4567
|
+
delta = 0
|
|
4568
|
+
h += 1
|
|
4569
|
+
end
|
|
4570
|
+
delta += handled_before_pass - counted
|
|
4571
|
+
|
|
4572
|
+
positions[n].each do |position|
|
|
4573
|
+
i = position + 1
|
|
4574
|
+
while i <= input.size
|
|
4575
|
+
handled[i] += 1
|
|
4576
|
+
i += i & -i
|
|
4562
4577
|
end
|
|
4563
4578
|
end
|
|
4564
4579
|
|
|
@@ -4566,20 +4581,7 @@ module Addressable
|
|
|
4566
4581
|
n += 1
|
|
4567
4582
|
end
|
|
4568
4583
|
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
outlen = out
|
|
4572
|
-
outlen.times do |j|
|
|
4573
|
-
c = output[j]
|
|
4574
|
-
unless c >= 0 && c <= 127
|
|
4575
|
-
raise StandardError, "Invalid output char."
|
|
4576
|
-
end
|
|
4577
|
-
unless PUNYCODE_PRINT_ASCII[c]
|
|
4578
|
-
raise PunycodeBadInput, "Input is invalid."
|
|
4579
|
-
end
|
|
4580
|
-
end
|
|
4581
|
-
|
|
4582
|
-
output[0..outlen].map { |x| x.chr }.join("").sub(/\0+\z/, "")
|
|
4584
|
+
output.pack("C*").force_encoding(Encoding::US_ASCII)
|
|
4583
4585
|
end
|
|
4584
4586
|
private_class_method :punycode_encode
|
|
4585
4587
|
|
|
@@ -4724,11 +4726,11 @@ module Addressable
|
|
|
4724
4726
|
# (for use in representing integers) in the range 0 to
|
|
4725
4727
|
# base - 1, or PUNYCODE_BASE if codepoint does not represent a value.
|
|
4726
4728
|
def self.punycode_decode_digit(codepoint)
|
|
4727
|
-
if codepoint
|
|
4729
|
+
if codepoint >= 48 && codepoint <= 57
|
|
4728
4730
|
codepoint - 22
|
|
4729
|
-
elsif codepoint
|
|
4731
|
+
elsif codepoint >= 65 && codepoint <= 90
|
|
4730
4732
|
codepoint - 65
|
|
4731
|
-
elsif codepoint
|
|
4733
|
+
elsif codepoint >= 97 && codepoint <= 122
|
|
4732
4734
|
codepoint - 97
|
|
4733
4735
|
else
|
|
4734
4736
|
PUNYCODE_BASE
|
data/lib/addressable/template.rb
CHANGED
|
@@ -910,7 +910,7 @@ module Addressable
|
|
|
910
910
|
def normalize_value(value)
|
|
911
911
|
# Handle unicode normalization
|
|
912
912
|
if value.respond_to?(:to_ary)
|
|
913
|
-
value.to_ary.map
|
|
913
|
+
value = value.to_ary.map { |val| normalize_value(val) }
|
|
914
914
|
elsif value.kind_of?(Hash)
|
|
915
915
|
value = value.inject({}) { |acc, (k, v)|
|
|
916
916
|
acc[normalize_value(k)] = normalize_value(v)
|
|
@@ -1085,10 +1085,10 @@ module Addressable
|
|
|
1085
1085
|
first_explode = explodes.index(true)
|
|
1086
1086
|
not_after_value =
|
|
1087
1087
|
"(?<![#{Addressable::URI::CharacterClasses::UNRESERVED}])"
|
|
1088
|
-
combined = varspecs.each_with_index.map do |varspec,
|
|
1088
|
+
combined = varspecs.each_with_index.map do |varspec, position|
|
|
1089
1089
|
_, name, modifier = *varspec.match(VARSPEC)
|
|
1090
1090
|
|
|
1091
|
-
result = results[
|
|
1091
|
+
result = results[position]
|
|
1092
1092
|
if result
|
|
1093
1093
|
"(?<#{name}>#{ result })"
|
|
1094
1094
|
else
|
|
@@ -1130,7 +1130,7 @@ module Addressable
|
|
|
1130
1130
|
# TruffleRuby).
|
|
1131
1131
|
value = "#{seg}(?:#{joiner}#{seg})*"
|
|
1132
1132
|
end
|
|
1133
|
-
if plain && first_explode &&
|
|
1133
|
+
if plain && first_explode && position > first_explode &&
|
|
1134
1134
|
(operator == '+' || operator == '#' || operator == ';')
|
|
1135
1135
|
# Exploded values were tried longest first, so whatever this
|
|
1136
1136
|
# variable could match after the first exploded one, that one
|
|
@@ -1146,7 +1146,7 @@ module Addressable
|
|
|
1146
1146
|
# 2.9.0 skipped the variable when it couldn't be empty.
|
|
1147
1147
|
"(?:(?<#{name}>)(?!#{RESERVED_NO_COMMA}))?"
|
|
1148
1148
|
end
|
|
1149
|
-
elsif plain && modifier == '*' && explodes[(
|
|
1149
|
+
elsif plain && modifier == '*' && explodes[(position + 1)..-1].any? &&
|
|
1150
1150
|
(operator.nil? || operator == '/' || operator == '.')
|
|
1151
1151
|
# Exploded values were tried shortest first, and a later
|
|
1152
1152
|
# exploded variable can match whatever this one leaves, so once
|
|
@@ -1154,7 +1154,7 @@ module Addressable
|
|
|
1154
1154
|
# fails too. Of the values tried, only the leading joiners are
|
|
1155
1155
|
# shorter than every value tried before them.
|
|
1156
1156
|
"(?<#{name}>(?:#{joiner})*)"
|
|
1157
|
-
elsif plain &&
|
|
1157
|
+
elsif plain && position > 0 && explodes[position - 1] &&
|
|
1158
1158
|
(operator == '?' || operator == '&')
|
|
1159
1159
|
# Whatever this variable could match after an exploded one,
|
|
1160
1160
|
# that one already tried matching itself, unless it couldn't:
|
|
@@ -1162,7 +1162,7 @@ module Addressable
|
|
|
1162
1162
|
# start right after an empty one.
|
|
1163
1163
|
"(?<#{name}>(?<=#{leader}#{joiner}|#{joiner}#{joiner})" \
|
|
1164
1164
|
"#{value || group})?"
|
|
1165
|
-
elsif operator == ';' && plain &&
|
|
1165
|
+
elsif operator == ';' && plain && position > 0
|
|
1166
1166
|
# Values were tried longest first, and splitting an earlier
|
|
1167
1167
|
# variable's run of characters with this one never gave a
|
|
1168
1168
|
# different result, so this one may only start after that run.
|
|
@@ -1172,7 +1172,7 @@ module Addressable
|
|
|
1172
1172
|
elsif varspecs.size > 1 && (operator == '+' || operator == '#') &&
|
|
1173
1173
|
varspec != varspecs.last
|
|
1174
1174
|
"(?<#{name}>#{RESERVED_NO_COMMA}*+)?"
|
|
1175
|
-
elsif plain &&
|
|
1175
|
+
elsif plain && position < varspecs.size - 1 &&
|
|
1176
1176
|
(operator.nil? || operator == '/' || operator == '.')
|
|
1177
1177
|
# Values were tried shortest first, so a run of characters
|
|
1178
1178
|
# without a joiner went to a later variable. The only other
|
data/lib/addressable/uri.rb
CHANGED
|
@@ -928,6 +928,11 @@ module Addressable
|
|
|
928
928
|
|
|
929
929
|
# Reset dependent values
|
|
930
930
|
@normalized_scheme = NONE
|
|
931
|
+
@normalized_user = NONE
|
|
932
|
+
@normalized_password = NONE
|
|
933
|
+
@normalized_userinfo = NONE
|
|
934
|
+
@normalized_port = NONE
|
|
935
|
+
@normalized_path = nil
|
|
931
936
|
remove_composite_values
|
|
932
937
|
|
|
933
938
|
# Ensure we haven't created an invalid URI
|
|
@@ -983,6 +988,7 @@ module Addressable
|
|
|
983
988
|
@normalized_userinfo = NONE
|
|
984
989
|
@authority = nil
|
|
985
990
|
@normalized_user = NONE
|
|
991
|
+
@normalized_password = NONE
|
|
986
992
|
remove_composite_values
|
|
987
993
|
|
|
988
994
|
# Ensure we haven't created an invalid URI
|
|
@@ -1038,6 +1044,7 @@ module Addressable
|
|
|
1038
1044
|
@normalized_userinfo = NONE
|
|
1039
1045
|
@authority = nil
|
|
1040
1046
|
@normalized_password = NONE
|
|
1047
|
+
@normalized_user = NONE
|
|
1041
1048
|
remove_composite_values
|
|
1042
1049
|
|
|
1043
1050
|
# Ensure we haven't created an invalid URI
|
|
@@ -1616,11 +1623,8 @@ module Addressable
|
|
|
1616
1623
|
# @return [String] The query component, normalized.
|
|
1617
1624
|
def normalized_query(*flags)
|
|
1618
1625
|
return nil unless self.query
|
|
1619
|
-
return @normalized_query
|
|
1620
|
-
|
|
1621
|
-
modified_query_class = Addressable::URI::CharacterClasses::QUERY.dup
|
|
1622
|
-
# Make sure possible key-value pair delimiters are escaped.
|
|
1623
|
-
modified_query_class.sub!("\\&", "").sub!("\\;", "")
|
|
1626
|
+
return @normalized_query if flags.empty? && @normalized_query != NONE
|
|
1627
|
+
normalized_query = begin
|
|
1624
1628
|
pairs = (query || "").split("&", -1)
|
|
1625
1629
|
pairs.delete_if(&:empty?).uniq! if flags.include?(:compacted)
|
|
1626
1630
|
pairs.sort! if flags.include?(:sorted)
|
|
@@ -1634,8 +1638,9 @@ module Addressable
|
|
|
1634
1638
|
component == "" ? nil : component
|
|
1635
1639
|
end
|
|
1636
1640
|
# All normalized values should be UTF-8
|
|
1637
|
-
force_utf8_encoding_if_needed(
|
|
1638
|
-
@normalized_query
|
|
1641
|
+
force_utf8_encoding_if_needed(normalized_query)
|
|
1642
|
+
@normalized_query = normalized_query if flags.empty?
|
|
1643
|
+
normalized_query
|
|
1639
1644
|
end
|
|
1640
1645
|
|
|
1641
1646
|
##
|
|
@@ -2403,7 +2408,8 @@ module Addressable
|
|
|
2403
2408
|
# @param [Proc] block
|
|
2404
2409
|
# A set of operations to perform on a given URI.
|
|
2405
2410
|
def defer_validation
|
|
2406
|
-
validation_was_deferred =
|
|
2411
|
+
validation_was_deferred =
|
|
2412
|
+
!!(defined?(@validation_deferred) && @validation_deferred)
|
|
2407
2413
|
raise LocalJumpError, "No block given." unless block_given?
|
|
2408
2414
|
@validation_deferred = true
|
|
2409
2415
|
yield
|
|
@@ -2581,6 +2587,9 @@ module Addressable
|
|
|
2581
2587
|
def remove_composite_values
|
|
2582
2588
|
@uri_string = nil
|
|
2583
2589
|
@hash = nil
|
|
2590
|
+
@site = nil
|
|
2591
|
+
@normalized_site = nil
|
|
2592
|
+
@normalized_authority = nil
|
|
2584
2593
|
end
|
|
2585
2594
|
|
|
2586
2595
|
##
|
|
@@ -2595,11 +2604,21 @@ module Addressable
|
|
|
2595
2604
|
|
|
2596
2605
|
private
|
|
2597
2606
|
|
|
2607
|
+
def initialize_copy(other)
|
|
2608
|
+
super
|
|
2609
|
+
instance_variables.each do |ivar|
|
|
2610
|
+
value = instance_variable_get(ivar)
|
|
2611
|
+
instance_variable_set(ivar, value.dup) if value.kind_of?(String)
|
|
2612
|
+
end
|
|
2613
|
+
end
|
|
2614
|
+
|
|
2598
2615
|
##
|
|
2599
2616
|
# Resets instance variables
|
|
2600
2617
|
#
|
|
2601
2618
|
# @api private
|
|
2602
2619
|
def reset_ivs
|
|
2620
|
+
@site = nil
|
|
2621
|
+
@normalized_site = nil
|
|
2603
2622
|
@scheme = nil
|
|
2604
2623
|
@user = nil
|
|
2605
2624
|
@normalized_scheme = NONE
|
data/lib/addressable/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: addressable
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.9.
|
|
4
|
+
version: 2.9.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bob Aman
|
|
@@ -53,7 +53,7 @@ homepage: https://github.com/sporkmonger/addressable
|
|
|
53
53
|
licenses:
|
|
54
54
|
- Apache-2.0
|
|
55
55
|
metadata:
|
|
56
|
-
changelog_uri: https://github.com/sporkmonger/addressable/blob/main/CHANGELOG.md#v2.9.
|
|
56
|
+
changelog_uri: https://github.com/sporkmonger/addressable/blob/main/CHANGELOG.md#v2.9.2
|
|
57
57
|
rdoc_options:
|
|
58
58
|
- "--main"
|
|
59
59
|
- README.md
|
|
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
70
70
|
- !ruby/object:Gem::Version
|
|
71
71
|
version: '0'
|
|
72
72
|
requirements: []
|
|
73
|
-
rubygems_version: 4.0.
|
|
73
|
+
rubygems_version: 4.0.20
|
|
74
74
|
specification_version: 4
|
|
75
75
|
summary: URI Implementation
|
|
76
76
|
test_files: []
|