addressable 2.3.2 → 2.8.7
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 +7 -0
- data/CHANGELOG.md +189 -28
- data/Gemfile +22 -8
- data/README.md +95 -61
- data/Rakefile +16 -16
- data/addressable.gemspec +28 -0
- data/lib/addressable/idna/native.rb +31 -8
- data/lib/addressable/idna/pure.rb +49 -202
- data/lib/addressable/idna.rb +3 -2
- data/lib/addressable/template.rb +255 -64
- data/lib/addressable/uri.rb +663 -306
- data/lib/addressable/version.rb +5 -4
- data/lib/addressable.rb +4 -0
- data/spec/addressable/idna_spec.rb +116 -45
- data/spec/addressable/net_http_compat_spec.rb +6 -3
- data/spec/addressable/security_spec.rb +58 -0
- data/spec/addressable/template_spec.rb +645 -382
- data/spec/addressable/uri_spec.rb +3014 -1238
- data/spec/spec_helper.rb +33 -0
- data/tasks/clobber.rake +2 -0
- data/tasks/gem.rake +27 -17
- data/tasks/git.rake +3 -1
- data/tasks/metrics.rake +2 -0
- data/tasks/profile.rake +72 -0
- data/tasks/rspec.rake +10 -45
- data/tasks/yard.rake +2 -0
- metadata +75 -73
- data/tasks/rubyforge.rake +0 -89
- data/website/index.html +0 -110
data/lib/addressable/version.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
2
3
|
#--
|
|
3
|
-
# Copyright (C)
|
|
4
|
+
# Copyright (C) Bob Aman
|
|
4
5
|
#
|
|
5
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
7
|
# you may not use this file except in compliance with the License.
|
|
@@ -21,8 +22,8 @@ if !defined?(Addressable::VERSION)
|
|
|
21
22
|
module Addressable
|
|
22
23
|
module VERSION
|
|
23
24
|
MAJOR = 2
|
|
24
|
-
MINOR =
|
|
25
|
-
TINY =
|
|
25
|
+
MINOR = 8
|
|
26
|
+
TINY = 7
|
|
26
27
|
|
|
27
28
|
STRING = [MAJOR, MINOR, TINY].join('.')
|
|
28
29
|
end
|
data/lib/addressable.rb
ADDED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright (C) Bob Aman
|
|
3
4
|
#
|
|
4
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
6
|
# you may not use this file except in compliance with the License.
|
|
@@ -14,6 +15,8 @@
|
|
|
14
15
|
# limitations under the License.
|
|
15
16
|
|
|
16
17
|
|
|
18
|
+
require "spec_helper"
|
|
19
|
+
|
|
17
20
|
# Have to use RubyGems to load the idn gem.
|
|
18
21
|
require "rubygems"
|
|
19
22
|
|
|
@@ -21,34 +24,45 @@ require "addressable/idna"
|
|
|
21
24
|
|
|
22
25
|
shared_examples_for "converting from unicode to ASCII" do
|
|
23
26
|
it "should convert 'www.google.com' correctly" do
|
|
24
|
-
Addressable::IDNA.to_ascii("www.google.com").
|
|
27
|
+
expect(Addressable::IDNA.to_ascii("www.google.com")).to eq("www.google.com")
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
long = 'AcinusFallumTrompetumNullunCreditumVisumEstAtCuadLongumEtCefallum.com'
|
|
31
|
+
it "should convert '#{long}' correctly" do
|
|
32
|
+
expect(Addressable::IDNA.to_ascii(long)).to eq(long)
|
|
25
33
|
end
|
|
26
34
|
|
|
27
35
|
it "should convert 'www.詹姆斯.com' correctly" do
|
|
28
|
-
Addressable::IDNA.to_ascii(
|
|
36
|
+
expect(Addressable::IDNA.to_ascii(
|
|
29
37
|
"www.詹姆斯.com"
|
|
30
|
-
).
|
|
38
|
+
)).to eq("www.xn--8ws00zhy3a.com")
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it "also accepts unicode strings encoded as ascii-8bit" do
|
|
42
|
+
expect(Addressable::IDNA.to_ascii(
|
|
43
|
+
"www.詹姆斯.com".b
|
|
44
|
+
)).to eq("www.xn--8ws00zhy3a.com")
|
|
31
45
|
end
|
|
32
46
|
|
|
33
47
|
it "should convert 'www.Iñtërnâtiônàlizætiøn.com' correctly" do
|
|
34
48
|
"www.Iñtërnâtiônàlizætiøn.com"
|
|
35
|
-
Addressable::IDNA.to_ascii(
|
|
49
|
+
expect(Addressable::IDNA.to_ascii(
|
|
36
50
|
"www.I\xC3\xB1t\xC3\xABrn\xC3\xA2ti\xC3\xB4" +
|
|
37
51
|
"n\xC3\xA0liz\xC3\xA6ti\xC3\xB8n.com"
|
|
38
|
-
).
|
|
52
|
+
)).to eq("www.xn--itrntinliztin-vdb0a5exd8ewcye.com")
|
|
39
53
|
end
|
|
40
54
|
|
|
41
55
|
it "should convert 'www.Iñtërnâtiônàlizætiøn.com' correctly" do
|
|
42
|
-
Addressable::IDNA.to_ascii(
|
|
56
|
+
expect(Addressable::IDNA.to_ascii(
|
|
43
57
|
"www.In\xCC\x83te\xCC\x88rna\xCC\x82tio\xCC\x82n" +
|
|
44
58
|
"a\xCC\x80liz\xC3\xA6ti\xC3\xB8n.com"
|
|
45
|
-
).
|
|
59
|
+
)).to eq("www.xn--itrntinliztin-vdb0a5exd8ewcye.com")
|
|
46
60
|
end
|
|
47
61
|
|
|
48
62
|
it "should convert " +
|
|
49
63
|
"'www.ほんとうにながいわけのわからないどめいんめいのらべるまだながくしないとたりない.w3.mag.keio.ac.jp' " +
|
|
50
64
|
"correctly" do
|
|
51
|
-
Addressable::IDNA.to_ascii(
|
|
65
|
+
expect(Addressable::IDNA.to_ascii(
|
|
52
66
|
"www.\343\201\273\343\202\223\343\201\250\343\201\206\343\201\253\343" +
|
|
53
67
|
"\201\252\343\201\214\343\201\204\343\202\217\343\201\221\343\201\256" +
|
|
54
68
|
"\343\202\217\343\201\213\343\202\211\343\201\252\343\201\204\343\201" +
|
|
@@ -57,15 +71,16 @@ shared_examples_for "converting from unicode to ASCII" do
|
|
|
57
71
|
"\343\201\252\343\201\214\343\201\217\343\201\227\343\201\252\343\201" +
|
|
58
72
|
"\204\343\201\250\343\201\237\343\202\212\343\201\252\343\201\204." +
|
|
59
73
|
"w3.mag.keio.ac.jp"
|
|
60
|
-
).
|
|
74
|
+
)).to eq(
|
|
61
75
|
"www.xn--n8jaaaaai5bhf7as8fsfk3jnknefdde3" +
|
|
62
76
|
"fg11amb5gzdb4wi9bya3kc6lra.w3.mag.keio.ac.jp"
|
|
77
|
+
)
|
|
63
78
|
end
|
|
64
79
|
|
|
65
80
|
it "should convert " +
|
|
66
81
|
"'www.ほんとうにながいわけのわからないどめいんめいのらべるまだながくしないとたりない.w3.mag.keio.ac.jp' " +
|
|
67
82
|
"correctly" do
|
|
68
|
-
Addressable::IDNA.to_ascii(
|
|
83
|
+
expect(Addressable::IDNA.to_ascii(
|
|
69
84
|
"www.\343\201\273\343\202\223\343\201\250\343\201\206\343\201\253\343" +
|
|
70
85
|
"\201\252\343\201\213\343\202\231\343\201\204\343\202\217\343\201\221" +
|
|
71
86
|
"\343\201\256\343\202\217\343\201\213\343\202\211\343\201\252\343\201" +
|
|
@@ -75,116 +90,170 @@ shared_examples_for "converting from unicode to ASCII" do
|
|
|
75
90
|
"\213\343\202\231\343\201\217\343\201\227\343\201\252\343\201\204\343" +
|
|
76
91
|
"\201\250\343\201\237\343\202\212\343\201\252\343\201\204." +
|
|
77
92
|
"w3.mag.keio.ac.jp"
|
|
78
|
-
).
|
|
93
|
+
)).to eq(
|
|
79
94
|
"www.xn--n8jaaaaai5bhf7as8fsfk3jnknefdde3" +
|
|
80
95
|
"fg11amb5gzdb4wi9bya3kc6lra.w3.mag.keio.ac.jp"
|
|
96
|
+
)
|
|
81
97
|
end
|
|
82
98
|
|
|
83
99
|
it "should convert '点心和烤鸭.w3.mag.keio.ac.jp' correctly" do
|
|
84
|
-
Addressable::IDNA.to_ascii(
|
|
100
|
+
expect(Addressable::IDNA.to_ascii(
|
|
85
101
|
"点心和烤鸭.w3.mag.keio.ac.jp"
|
|
86
|
-
).
|
|
102
|
+
)).to eq("xn--0trv4xfvn8el34t.w3.mag.keio.ac.jp")
|
|
87
103
|
end
|
|
88
104
|
|
|
89
105
|
it "should convert '가각갂갃간갅갆갇갈갉힢힣.com' correctly" do
|
|
90
|
-
Addressable::IDNA.to_ascii(
|
|
106
|
+
expect(Addressable::IDNA.to_ascii(
|
|
91
107
|
"가각갂갃간갅갆갇갈갉힢힣.com"
|
|
92
|
-
).
|
|
108
|
+
)).to eq("xn--o39acdefghijk5883jma.com")
|
|
93
109
|
end
|
|
94
110
|
|
|
95
111
|
it "should convert " +
|
|
96
112
|
"'\347\242\274\346\250\231\346\272\226\350" +
|
|
97
113
|
"\220\254\345\234\213\347\242\274.com' correctly" do
|
|
98
|
-
Addressable::IDNA.to_ascii(
|
|
114
|
+
expect(Addressable::IDNA.to_ascii(
|
|
99
115
|
"\347\242\274\346\250\231\346\272\226\350" +
|
|
100
116
|
"\220\254\345\234\213\347\242\274.com"
|
|
101
|
-
).
|
|
117
|
+
)).to eq("xn--9cs565brid46mda086o.com")
|
|
102
118
|
end
|
|
103
119
|
|
|
104
120
|
it "should convert 'リ宠퐱〹.com' correctly" do
|
|
105
|
-
Addressable::IDNA.to_ascii(
|
|
121
|
+
expect(Addressable::IDNA.to_ascii(
|
|
106
122
|
"\357\276\230\345\256\240\355\220\261\343\200\271.com"
|
|
107
|
-
).
|
|
123
|
+
)).to eq("xn--eek174hoxfpr4k.com")
|
|
108
124
|
end
|
|
109
125
|
|
|
110
126
|
it "should convert 'リ宠퐱卄.com' correctly" do
|
|
111
|
-
Addressable::IDNA.to_ascii(
|
|
127
|
+
expect(Addressable::IDNA.to_ascii(
|
|
112
128
|
"\343\203\252\345\256\240\355\220\261\345\215\204.com"
|
|
113
|
-
).
|
|
129
|
+
)).to eq("xn--eek174hoxfpr4k.com")
|
|
114
130
|
end
|
|
115
131
|
|
|
116
132
|
it "should convert 'ᆵ' correctly" do
|
|
117
|
-
Addressable::IDNA.to_ascii(
|
|
133
|
+
expect(Addressable::IDNA.to_ascii(
|
|
118
134
|
"\341\206\265"
|
|
119
|
-
).
|
|
135
|
+
)).to eq("xn--4ud")
|
|
120
136
|
end
|
|
121
137
|
|
|
122
138
|
it "should convert 'ᆵ' correctly" do
|
|
123
|
-
Addressable::IDNA.to_ascii(
|
|
139
|
+
expect(Addressable::IDNA.to_ascii(
|
|
124
140
|
"\357\276\257"
|
|
125
|
-
).
|
|
141
|
+
)).to eq("xn--4ud")
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
it "should convert '🌹🌹🌹.ws' correctly" do
|
|
145
|
+
expect(Addressable::IDNA.to_ascii(
|
|
146
|
+
"\360\237\214\271\360\237\214\271\360\237\214\271.ws"
|
|
147
|
+
)).to eq("xn--2h8haa.ws")
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
it "should handle two adjacent '.'s correctly" do
|
|
151
|
+
expect(Addressable::IDNA.to_ascii(
|
|
152
|
+
"example..host"
|
|
153
|
+
)).to eq("example..host")
|
|
126
154
|
end
|
|
127
155
|
end
|
|
128
156
|
|
|
129
157
|
shared_examples_for "converting from ASCII to unicode" do
|
|
158
|
+
long = 'AcinusFallumTrompetumNullunCreditumVisumEstAtCuadLongumEtCefallum.com'
|
|
159
|
+
it "should convert '#{long}' correctly" do
|
|
160
|
+
expect(Addressable::IDNA.to_unicode(long)).to eq(long)
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
it "should return the identity conversion when punycode decode fails" do
|
|
164
|
+
expect(Addressable::IDNA.to_unicode("xn--zckp1cyg1.sblo.jp")).to eq(
|
|
165
|
+
"xn--zckp1cyg1.sblo.jp")
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
it "should return the identity conversion when the ACE prefix has no suffix" do
|
|
169
|
+
expect(Addressable::IDNA.to_unicode("xn--...-")).to eq("xn--...-")
|
|
170
|
+
end
|
|
171
|
+
|
|
130
172
|
it "should convert 'www.google.com' correctly" do
|
|
131
|
-
Addressable::IDNA.to_unicode("www.google.com").
|
|
173
|
+
expect(Addressable::IDNA.to_unicode("www.google.com")).to eq(
|
|
174
|
+
"www.google.com")
|
|
132
175
|
end
|
|
133
176
|
|
|
134
177
|
it "should convert 'www.詹姆斯.com' correctly" do
|
|
135
|
-
Addressable::IDNA.to_unicode(
|
|
178
|
+
expect(Addressable::IDNA.to_unicode(
|
|
136
179
|
"www.xn--8ws00zhy3a.com"
|
|
137
|
-
).
|
|
180
|
+
)).to eq("www.詹姆斯.com")
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
it "should convert '詹姆斯.com' correctly" do
|
|
184
|
+
expect(Addressable::IDNA.to_unicode(
|
|
185
|
+
"xn--8ws00zhy3a.com"
|
|
186
|
+
)).to eq("詹姆斯.com")
|
|
138
187
|
end
|
|
139
188
|
|
|
140
189
|
it "should convert 'www.iñtërnâtiônàlizætiøn.com' correctly" do
|
|
141
|
-
Addressable::IDNA.to_unicode(
|
|
190
|
+
expect(Addressable::IDNA.to_unicode(
|
|
142
191
|
"www.xn--itrntinliztin-vdb0a5exd8ewcye.com"
|
|
143
|
-
).
|
|
192
|
+
)).to eq("www.iñtërnâtiônàlizætiøn.com")
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
it "should convert 'iñtërnâtiônàlizætiøn.com' correctly" do
|
|
196
|
+
expect(Addressable::IDNA.to_unicode(
|
|
197
|
+
"xn--itrntinliztin-vdb0a5exd8ewcye.com"
|
|
198
|
+
)).to eq("iñtërnâtiônàlizætiøn.com")
|
|
144
199
|
end
|
|
145
200
|
|
|
146
201
|
it "should convert " +
|
|
147
202
|
"'www.ほんとうにながいわけのわからないどめいんめいのらべるまだながくしないとたりない.w3.mag.keio.ac.jp' " +
|
|
148
203
|
"correctly" do
|
|
149
|
-
Addressable::IDNA.to_unicode(
|
|
204
|
+
expect(Addressable::IDNA.to_unicode(
|
|
150
205
|
"www.xn--n8jaaaaai5bhf7as8fsfk3jnknefdde3" +
|
|
151
206
|
"fg11amb5gzdb4wi9bya3kc6lra.w3.mag.keio.ac.jp"
|
|
152
|
-
).
|
|
207
|
+
)).to eq(
|
|
153
208
|
"www.ほんとうにながいわけのわからないどめいんめいのらべるまだながくしないとたりない.w3.mag.keio.ac.jp"
|
|
209
|
+
)
|
|
154
210
|
end
|
|
155
211
|
|
|
156
212
|
it "should convert '点心和烤鸭.w3.mag.keio.ac.jp' correctly" do
|
|
157
|
-
Addressable::IDNA.to_unicode(
|
|
213
|
+
expect(Addressable::IDNA.to_unicode(
|
|
158
214
|
"xn--0trv4xfvn8el34t.w3.mag.keio.ac.jp"
|
|
159
|
-
).
|
|
215
|
+
)).to eq("点心和烤鸭.w3.mag.keio.ac.jp")
|
|
160
216
|
end
|
|
161
217
|
|
|
162
218
|
it "should convert '가각갂갃간갅갆갇갈갉힢힣.com' correctly" do
|
|
163
|
-
Addressable::IDNA.to_unicode(
|
|
219
|
+
expect(Addressable::IDNA.to_unicode(
|
|
164
220
|
"xn--o39acdefghijk5883jma.com"
|
|
165
|
-
).
|
|
221
|
+
)).to eq("가각갂갃간갅갆갇갈갉힢힣.com")
|
|
166
222
|
end
|
|
167
223
|
|
|
168
224
|
it "should convert " +
|
|
169
225
|
"'\347\242\274\346\250\231\346\272\226\350" +
|
|
170
226
|
"\220\254\345\234\213\347\242\274.com' correctly" do
|
|
171
|
-
Addressable::IDNA.to_unicode(
|
|
227
|
+
expect(Addressable::IDNA.to_unicode(
|
|
172
228
|
"xn--9cs565brid46mda086o.com"
|
|
173
|
-
).
|
|
229
|
+
)).to eq(
|
|
174
230
|
"\347\242\274\346\250\231\346\272\226\350" +
|
|
175
231
|
"\220\254\345\234\213\347\242\274.com"
|
|
232
|
+
)
|
|
176
233
|
end
|
|
177
234
|
|
|
178
235
|
it "should convert 'リ宠퐱卄.com' correctly" do
|
|
179
|
-
Addressable::IDNA.to_unicode(
|
|
236
|
+
expect(Addressable::IDNA.to_unicode(
|
|
180
237
|
"xn--eek174hoxfpr4k.com"
|
|
181
|
-
).
|
|
238
|
+
)).to eq("\343\203\252\345\256\240\355\220\261\345\215\204.com")
|
|
182
239
|
end
|
|
183
240
|
|
|
184
241
|
it "should convert 'ᆵ' correctly" do
|
|
185
|
-
Addressable::IDNA.to_unicode(
|
|
242
|
+
expect(Addressable::IDNA.to_unicode(
|
|
186
243
|
"xn--4ud"
|
|
187
|
-
).
|
|
244
|
+
)).to eq("\341\206\265")
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
it "should convert '🌹🌹🌹.ws' correctly" do
|
|
248
|
+
expect(Addressable::IDNA.to_unicode(
|
|
249
|
+
"xn--2h8haa.ws"
|
|
250
|
+
)).to eq("\360\237\214\271\360\237\214\271\360\237\214\271.ws")
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
it "should handle two adjacent '.'s correctly" do
|
|
254
|
+
expect(Addressable::IDNA.to_unicode(
|
|
255
|
+
"example..host"
|
|
256
|
+
)).to eq("example..host")
|
|
188
257
|
end
|
|
189
258
|
end
|
|
190
259
|
|
|
@@ -225,7 +294,9 @@ begin
|
|
|
225
294
|
it_should_behave_like "converting from unicode to ASCII"
|
|
226
295
|
it_should_behave_like "converting from ASCII to unicode"
|
|
227
296
|
end
|
|
228
|
-
rescue LoadError
|
|
297
|
+
rescue LoadError => error
|
|
298
|
+
raise error if ENV["CI"] && TestHelper.native_supported?
|
|
299
|
+
|
|
229
300
|
# Cannot test the native implementation without libidn support.
|
|
230
301
|
warn('Could not load native IDN implementation.')
|
|
231
302
|
end
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright (C) Bob Aman
|
|
3
4
|
#
|
|
4
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
6
|
# you may not use this file except in compliance with the License.
|
|
@@ -14,6 +15,8 @@
|
|
|
14
15
|
# limitations under the License.
|
|
15
16
|
|
|
16
17
|
|
|
18
|
+
require "spec_helper"
|
|
19
|
+
|
|
17
20
|
require "addressable/uri"
|
|
18
21
|
require "net/http"
|
|
19
22
|
|
|
@@ -21,6 +24,6 @@ describe Net::HTTP do
|
|
|
21
24
|
it "should be compatible with Addressable" do
|
|
22
25
|
response_body =
|
|
23
26
|
Net::HTTP.get(Addressable::URI.parse('http://www.google.com/'))
|
|
24
|
-
response_body.
|
|
27
|
+
expect(response_body).not_to be_nil
|
|
25
28
|
end
|
|
26
29
|
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright (C) Bob Aman
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
require "spec_helper"
|
|
19
|
+
|
|
20
|
+
require "addressable/uri"
|
|
21
|
+
|
|
22
|
+
describe Addressable::URI, "when created with a URI known to cause crashes " +
|
|
23
|
+
"in certain browsers" do
|
|
24
|
+
it "should parse correctly" do
|
|
25
|
+
uri = Addressable::URI.parse('%%30%30')
|
|
26
|
+
expect(uri.path).to eq('%%30%30')
|
|
27
|
+
expect(uri.normalize.path).to eq('%2500')
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it "should parse correctly as a full URI" do
|
|
31
|
+
uri = Addressable::URI.parse('http://www.example.com/%%30%30')
|
|
32
|
+
expect(uri.path).to eq('/%%30%30')
|
|
33
|
+
expect(uri.normalize.path).to eq('/%2500')
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
describe Addressable::URI, "when created with a URI known to cause crashes " +
|
|
38
|
+
"in certain browsers" do
|
|
39
|
+
it "should parse correctly" do
|
|
40
|
+
uri = Addressable::URI.parse('لُصّبُلُلصّبُررً ॣ ॣh ॣ ॣ 冗')
|
|
41
|
+
expect(uri.path).to eq('لُصّبُلُلصّبُررً ॣ ॣh ॣ ॣ 冗')
|
|
42
|
+
expect(uri.normalize.path).to eq(
|
|
43
|
+
'%D9%84%D9%8F%D8%B5%D9%91%D8%A8%D9%8F%D9%84%D9%8F%D9%84%D8%B5%D9%91' +
|
|
44
|
+
'%D8%A8%D9%8F%D8%B1%D8%B1%D9%8B%20%E0%A5%A3%20%E0%A5%A3h%20%E0%A5' +
|
|
45
|
+
'%A3%20%E0%A5%A3%20%E5%86%97'
|
|
46
|
+
)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it "should parse correctly as a full URI" do
|
|
50
|
+
uri = Addressable::URI.parse('http://www.example.com/لُصّبُلُلصّبُررً ॣ ॣh ॣ ॣ 冗')
|
|
51
|
+
expect(uri.path).to eq('/لُصّبُلُلصّبُررً ॣ ॣh ॣ ॣ 冗')
|
|
52
|
+
expect(uri.normalize.path).to eq(
|
|
53
|
+
'/%D9%84%D9%8F%D8%B5%D9%91%D8%A8%D9%8F%D9%84%D9%8F%D9%84%D8%B5%D9%91' +
|
|
54
|
+
'%D8%A8%D9%8F%D8%B1%D8%B1%D9%8B%20%E0%A5%A3%20%E0%A5%A3h%20%E0%A5' +
|
|
55
|
+
'%A3%20%E0%A5%A3%20%E5%86%97'
|
|
56
|
+
)
|
|
57
|
+
end
|
|
58
|
+
end
|