addressable 2.2.3 → 2.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +5 -0
- data/lib/addressable/uri.rb +24 -1
- data/lib/addressable/version.rb +1 -1
- data/spec/addressable/uri_spec.rb +240 -3
- metadata +4 -4
data/CHANGELOG
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
=== Addressable 2.2.4
|
2
|
+
- added origin support from draft-ietf-websec-origin-00
|
3
|
+
- resolved issue with attempting to navigate below root
|
4
|
+
- fixed bug with string splitting in query strings
|
5
|
+
|
1
6
|
=== Addressable 2.2.3
|
2
7
|
- added :flat_array notation for query strings
|
3
8
|
|
data/lib/addressable/uri.rb
CHANGED
@@ -1077,6 +1077,26 @@ module Addressable
|
|
1077
1077
|
validate()
|
1078
1078
|
end
|
1079
1079
|
|
1080
|
+
##
|
1081
|
+
# The origin for this URI, serialized to ASCII, as per
|
1082
|
+
# draft-ietf-websec-origin-00, section 5.2.
|
1083
|
+
#
|
1084
|
+
# @return [String] The serialized origin.
|
1085
|
+
def origin
|
1086
|
+
return (if self.scheme && self.authority
|
1087
|
+
if self.normalized_port
|
1088
|
+
(
|
1089
|
+
"#{self.normalized_scheme}://#{self.normalized_host}" +
|
1090
|
+
":#{self.normalized_port}"
|
1091
|
+
)
|
1092
|
+
else
|
1093
|
+
"#{self.normalized_scheme}://#{self.normalized_host}"
|
1094
|
+
end
|
1095
|
+
else
|
1096
|
+
"null"
|
1097
|
+
end)
|
1098
|
+
end
|
1099
|
+
|
1080
1100
|
# Returns an array of known ip-based schemes. These schemes typically
|
1081
1101
|
# use a similar URI form:
|
1082
1102
|
# <code>//<user>:<password>@<host>:<port>/<url-path></code>
|
@@ -1430,7 +1450,7 @@ module Addressable
|
|
1430
1450
|
return nil if self.query == nil
|
1431
1451
|
empty_accumulator = :flat_array == options[:notation] ? [] : {}
|
1432
1452
|
return ((self.query.split("&").map do |pair|
|
1433
|
-
pair.split("=",
|
1453
|
+
pair.split("=", 2) if pair && pair != ""
|
1434
1454
|
end).compact.inject(empty_accumulator.dup) do |accumulator, (key, value)|
|
1435
1455
|
value = true if value.nil?
|
1436
1456
|
key = self.class.unencode_component(key)
|
@@ -2212,6 +2232,9 @@ module Addressable
|
|
2212
2232
|
end
|
2213
2233
|
normalized_path.gsub!(/^\.\.?\/?/, "")
|
2214
2234
|
normalized_path.gsub!(/^\/\.\.?\//, "/")
|
2235
|
+
|
2236
|
+
# Non-standard
|
2237
|
+
normalized_path.gsub!(/^(\/\.\.?)+\/?$/, "/")
|
2215
2238
|
end until previous_state == normalized_path
|
2216
2239
|
return normalized_path
|
2217
2240
|
end
|
data/lib/addressable/version.rb
CHANGED
@@ -271,6 +271,10 @@ describe Addressable::URI, "when created with an authority and no port" do
|
|
271
271
|
it "should have a site value of '//user@example.com'" do
|
272
272
|
@uri.site.should == "//user@example.com"
|
273
273
|
end
|
274
|
+
|
275
|
+
it "should have a 'null' origin" do
|
276
|
+
@uri.origin.should == 'null'
|
277
|
+
end
|
274
278
|
end
|
275
279
|
|
276
280
|
describe Addressable::URI, "when created with both a userinfo and a user" do
|
@@ -296,6 +300,10 @@ describe Addressable::URI, "when created with a path that hasn't been " +
|
|
296
300
|
it "should have a site value of 'http://example.com'" do
|
297
301
|
@uri.site.should == "http://example.com"
|
298
302
|
end
|
303
|
+
|
304
|
+
it "should have an origin of 'http://example.com" do
|
305
|
+
@uri.origin.should == 'http://example.com'
|
306
|
+
end
|
299
307
|
end
|
300
308
|
|
301
309
|
describe Addressable::URI, "when created with a path that hasn't been " +
|
@@ -309,10 +317,14 @@ describe Addressable::URI, "when created with a path that hasn't been " +
|
|
309
317
|
it "should not prefix a '/' to the path" do
|
310
318
|
@uri.should == Addressable::URI.parse("http:path")
|
311
319
|
end
|
312
|
-
|
320
|
+
|
313
321
|
it "should have a site value of 'http:'" do
|
314
322
|
@uri.site.should == "http:"
|
315
323
|
end
|
324
|
+
|
325
|
+
it "should have a 'null' origin" do
|
326
|
+
@uri.origin.should == 'null'
|
327
|
+
end
|
316
328
|
end
|
317
329
|
|
318
330
|
describe Addressable::URI, "when parsed from an Addressable::URI object" do
|
@@ -369,6 +381,10 @@ describe Addressable::URI, "when parsed from ''" do
|
|
369
381
|
it "should be considered to be in normal form" do
|
370
382
|
@uri.normalize.should be_eql(@uri)
|
371
383
|
end
|
384
|
+
|
385
|
+
it "should have a 'null' origin" do
|
386
|
+
@uri.origin.should == 'null'
|
387
|
+
end
|
372
388
|
end
|
373
389
|
|
374
390
|
# Section 1.1.2 of RFC 3986
|
@@ -401,6 +417,10 @@ describe Addressable::URI, "when parsed from " +
|
|
401
417
|
it "should be considered to be in normal form" do
|
402
418
|
@uri.normalize.should be_eql(@uri)
|
403
419
|
end
|
420
|
+
|
421
|
+
it "should have an origin of 'ftp://ftp.is.co.za'" do
|
422
|
+
@uri.origin.should == 'ftp://ftp.is.co.za'
|
423
|
+
end
|
404
424
|
end
|
405
425
|
|
406
426
|
# Section 1.1.2 of RFC 3986
|
@@ -443,6 +463,10 @@ describe Addressable::URI, "when parsed from " +
|
|
443
463
|
@uri.omit!(:scheme)
|
444
464
|
@uri.to_s.should == "//www.ietf.org/rfc/rfc2396.txt"
|
445
465
|
end
|
466
|
+
|
467
|
+
it "should have an origin of 'http://www.ietf.org'" do
|
468
|
+
@uri.origin.should == 'http://www.ietf.org'
|
469
|
+
end
|
446
470
|
end
|
447
471
|
|
448
472
|
# Section 1.1.2 of RFC 3986
|
@@ -501,6 +525,10 @@ describe Addressable::URI, "when parsed from " +
|
|
501
525
|
@uri.omit(:authority, :path)
|
502
526
|
end).should raise_error(Addressable::URI::InvalidURIError)
|
503
527
|
end
|
528
|
+
|
529
|
+
it "should have an origin of 'ldap://[2001:db8::7]'" do
|
530
|
+
@uri.origin.should == 'ldap://[2001:db8::7]'
|
531
|
+
end
|
504
532
|
end
|
505
533
|
|
506
534
|
# Section 1.1.2 of RFC 3986
|
@@ -529,6 +557,10 @@ describe Addressable::URI, "when parsed from " +
|
|
529
557
|
it "should be considered to be in normal form" do
|
530
558
|
@uri.normalize.should be_eql(@uri)
|
531
559
|
end
|
560
|
+
|
561
|
+
it "should have a 'null' origin" do
|
562
|
+
@uri.origin.should == 'null'
|
563
|
+
end
|
532
564
|
end
|
533
565
|
|
534
566
|
# Section 1.1.2 of RFC 3986
|
@@ -557,6 +589,10 @@ describe Addressable::URI, "when parsed from " +
|
|
557
589
|
it "should be considered to be in normal form" do
|
558
590
|
@uri.normalize.should be_eql(@uri)
|
559
591
|
end
|
592
|
+
|
593
|
+
it "should have a 'null' origin" do
|
594
|
+
@uri.origin.should == 'null'
|
595
|
+
end
|
560
596
|
end
|
561
597
|
|
562
598
|
# Section 1.1.2 of RFC 3986
|
@@ -585,6 +621,10 @@ describe Addressable::URI, "when parsed from " +
|
|
585
621
|
it "should be considered to be in normal form" do
|
586
622
|
@uri.normalize.should be_eql(@uri)
|
587
623
|
end
|
624
|
+
|
625
|
+
it "should have a 'null' origin" do
|
626
|
+
@uri.origin.should == 'null'
|
627
|
+
end
|
588
628
|
end
|
589
629
|
|
590
630
|
# Section 1.1.2 of RFC 3986
|
@@ -621,6 +661,10 @@ describe Addressable::URI, "when parsed from " +
|
|
621
661
|
it "should be considered to be in normal form" do
|
622
662
|
@uri.normalize.should be_eql(@uri)
|
623
663
|
end
|
664
|
+
|
665
|
+
it "should have an origin of 'telnet://192.0.2.16:80'" do
|
666
|
+
@uri.origin.should == 'telnet://192.0.2.16:80'
|
667
|
+
end
|
624
668
|
end
|
625
669
|
|
626
670
|
# Section 1.1.2 of RFC 3986
|
@@ -651,6 +695,10 @@ describe Addressable::URI, "when parsed from " +
|
|
651
695
|
it "should be considered to be in normal form" do
|
652
696
|
@uri.normalize.should be_eql(@uri)
|
653
697
|
end
|
698
|
+
|
699
|
+
it "should have a 'null' origin" do
|
700
|
+
@uri.origin.should == 'null'
|
701
|
+
end
|
654
702
|
end
|
655
703
|
|
656
704
|
describe Addressable::URI, "when parsed from " +
|
@@ -926,6 +974,10 @@ describe Addressable::URI, "when parsed from " +
|
|
926
974
|
it "should be identical to its duplicate" do
|
927
975
|
@uri.should == @uri.dup
|
928
976
|
end
|
977
|
+
|
978
|
+
it "should have an origin of 'http://example.com'" do
|
979
|
+
@uri.origin.should == 'http://example.com'
|
980
|
+
end
|
929
981
|
end
|
930
982
|
|
931
983
|
# Section 5.1.2 of RFC 2616
|
@@ -977,6 +1029,10 @@ describe Addressable::URI, "when parsed from " +
|
|
977
1029
|
:fragment => nil
|
978
1030
|
}
|
979
1031
|
end
|
1032
|
+
|
1033
|
+
it "should have an origin of 'http://www.w3.org'" do
|
1034
|
+
@uri.origin.should == 'http://www.w3.org'
|
1035
|
+
end
|
980
1036
|
end
|
981
1037
|
|
982
1038
|
describe Addressable::URI, "when parsed from " +
|
@@ -1092,6 +1148,10 @@ describe Addressable::URI, "when parsed from " +
|
|
1092
1148
|
it "should have a different hash from http://example.com" do
|
1093
1149
|
@uri.hash.should_not == Addressable::URI.parse("http://example.com").hash
|
1094
1150
|
end
|
1151
|
+
|
1152
|
+
it "should have an origin of 'http://example.com'" do
|
1153
|
+
@uri.origin.should == 'http://example.com'
|
1154
|
+
end
|
1095
1155
|
end
|
1096
1156
|
|
1097
1157
|
describe Addressable::URI, "when parsed from " +
|
@@ -1120,6 +1180,10 @@ describe Addressable::URI, "when parsed from " +
|
|
1120
1180
|
it "should be identical to its duplicate" do
|
1121
1181
|
@uri.should == @uri.dup
|
1122
1182
|
end
|
1183
|
+
|
1184
|
+
it "should have an origin of 'http://example.com'" do
|
1185
|
+
@uri.origin.should == 'http://example.com'
|
1186
|
+
end
|
1123
1187
|
end
|
1124
1188
|
|
1125
1189
|
describe Addressable::URI, "when parsed from " +
|
@@ -1139,6 +1203,10 @@ describe Addressable::URI, "when parsed from " +
|
|
1139
1203
|
it "should be identical to its duplicate" do
|
1140
1204
|
@uri.should == @uri.dup
|
1141
1205
|
end
|
1206
|
+
|
1207
|
+
it "should have an origin of 'http://example.com'" do
|
1208
|
+
@uri.origin.should == 'http://example.com'
|
1209
|
+
end
|
1142
1210
|
end
|
1143
1211
|
|
1144
1212
|
describe Addressable::URI, "when parsed from " +
|
@@ -1167,6 +1235,10 @@ describe Addressable::URI, "when parsed from " +
|
|
1167
1235
|
it "should be identical to its duplicate" do
|
1168
1236
|
@uri.should == @uri.dup
|
1169
1237
|
end
|
1238
|
+
|
1239
|
+
it "should have an origin of 'http://example.com'" do
|
1240
|
+
@uri.origin.should == 'http://example.com'
|
1241
|
+
end
|
1170
1242
|
end
|
1171
1243
|
|
1172
1244
|
describe Addressable::URI, "when parsed from " +
|
@@ -1504,6 +1576,10 @@ describe Addressable::URI, "when parsed from " +
|
|
1504
1576
|
it "should be identical to its duplicate" do
|
1505
1577
|
@uri.should == @uri.dup
|
1506
1578
|
end
|
1579
|
+
|
1580
|
+
it "should have an origin of 'http://example.com'" do
|
1581
|
+
@uri.origin.should == 'http://example.com'
|
1582
|
+
end
|
1507
1583
|
end
|
1508
1584
|
|
1509
1585
|
describe Addressable::URI, "when parsed from " +
|
@@ -1601,6 +1677,10 @@ describe Addressable::URI, "when parsed from " +
|
|
1601
1677
|
it "should be identical to its duplicate" do
|
1602
1678
|
@uri.should == @uri.dup
|
1603
1679
|
end
|
1680
|
+
|
1681
|
+
it "should have an origin of 'http://example.com:8080'" do
|
1682
|
+
@uri.origin.should == 'http://example.com:8080'
|
1683
|
+
end
|
1604
1684
|
end
|
1605
1685
|
|
1606
1686
|
describe Addressable::URI, "when parsed from " +
|
@@ -1620,6 +1700,48 @@ describe Addressable::URI, "when parsed from " +
|
|
1620
1700
|
it "should normalize to 'http://example.com/'" do
|
1621
1701
|
@uri.normalize.should === "http://example.com/"
|
1622
1702
|
end
|
1703
|
+
|
1704
|
+
it "should have an origin of 'http://example.com'" do
|
1705
|
+
@uri.origin.should == 'http://example.com'
|
1706
|
+
end
|
1707
|
+
end
|
1708
|
+
|
1709
|
+
describe Addressable::URI, "when parsed from " +
|
1710
|
+
"'http://example.com/..'" do
|
1711
|
+
before do
|
1712
|
+
@uri = Addressable::URI.parse("http://example.com/..")
|
1713
|
+
end
|
1714
|
+
|
1715
|
+
it "should have the correct port" do
|
1716
|
+
@uri.inferred_port.should == 80
|
1717
|
+
end
|
1718
|
+
|
1719
|
+
it "should not be considered to be in normal form" do
|
1720
|
+
@uri.normalize.should_not be_eql(@uri)
|
1721
|
+
end
|
1722
|
+
|
1723
|
+
it "should normalize to 'http://example.com/'" do
|
1724
|
+
@uri.normalize.should === "http://example.com/"
|
1725
|
+
end
|
1726
|
+
end
|
1727
|
+
|
1728
|
+
describe Addressable::URI, "when parsed from " +
|
1729
|
+
"'http://example.com/../..'" do
|
1730
|
+
before do
|
1731
|
+
@uri = Addressable::URI.parse("http://example.com/../..")
|
1732
|
+
end
|
1733
|
+
|
1734
|
+
it "should have the correct port" do
|
1735
|
+
@uri.inferred_port.should == 80
|
1736
|
+
end
|
1737
|
+
|
1738
|
+
it "should not be considered to be in normal form" do
|
1739
|
+
@uri.normalize.should_not be_eql(@uri)
|
1740
|
+
end
|
1741
|
+
|
1742
|
+
it "should normalize to 'http://example.com/'" do
|
1743
|
+
@uri.normalize.should === "http://example.com/"
|
1744
|
+
end
|
1623
1745
|
end
|
1624
1746
|
|
1625
1747
|
describe Addressable::URI, "when parsed from " +
|
@@ -2145,6 +2267,10 @@ describe Addressable::URI, "when parsed from " +
|
|
2145
2267
|
it "should be considered to be in normal form" do
|
2146
2268
|
@uri.normalize.should be_eql(@uri)
|
2147
2269
|
end
|
2270
|
+
|
2271
|
+
it "should have a 'null' origin" do
|
2272
|
+
@uri.origin.should == 'null'
|
2273
|
+
end
|
2148
2274
|
end
|
2149
2275
|
|
2150
2276
|
describe Addressable::URI, "when parsed from " +
|
@@ -2186,6 +2312,10 @@ describe Addressable::URI, "when parsed from " +
|
|
2186
2312
|
it "should be considered to be in normal form" do
|
2187
2313
|
@uri.normalize.should be_eql(@uri)
|
2188
2314
|
end
|
2315
|
+
|
2316
|
+
it "should have a 'null' origin" do
|
2317
|
+
@uri.origin.should == 'null'
|
2318
|
+
end
|
2189
2319
|
end
|
2190
2320
|
|
2191
2321
|
describe Addressable::URI, "when parsed from " +
|
@@ -2526,6 +2656,10 @@ describe Addressable::URI, "when parsed from " +
|
|
2526
2656
|
it "should be identical to its duplicate" do
|
2527
2657
|
@uri.should == @uri.dup
|
2528
2658
|
end
|
2659
|
+
|
2660
|
+
it "should have an origin of 'http://example.com'" do
|
2661
|
+
@uri.origin.should == 'http://example.com'
|
2662
|
+
end
|
2529
2663
|
end
|
2530
2664
|
|
2531
2665
|
describe Addressable::URI, "when parsed from " +
|
@@ -2908,6 +3042,10 @@ describe Addressable::URI, "when parsed from " +
|
|
2908
3042
|
@uri.route_from("http://example.com/")
|
2909
3043
|
end).should raise_error(ArgumentError, /\/\/example.com\//)
|
2910
3044
|
end
|
3045
|
+
|
3046
|
+
it "should have a 'null' origin" do
|
3047
|
+
@uri.origin.should == 'null'
|
3048
|
+
end
|
2911
3049
|
end
|
2912
3050
|
|
2913
3051
|
describe Addressable::URI, "when parsed from " +
|
@@ -2939,6 +3077,10 @@ describe Addressable::URI, "when parsed from " +
|
|
2939
3077
|
@uri.normalize.to_s.should == "http://example.com/"
|
2940
3078
|
@uri.normalize!.to_s.should == "http://example.com/"
|
2941
3079
|
end
|
3080
|
+
|
3081
|
+
it "should have a 'null' origin" do
|
3082
|
+
@uri.origin.should == 'null'
|
3083
|
+
end
|
2942
3084
|
end
|
2943
3085
|
|
2944
3086
|
describe Addressable::URI, "when parsed from " +
|
@@ -2952,6 +3094,10 @@ describe Addressable::URI, "when parsed from " +
|
|
2952
3094
|
@uri.should ==
|
2953
3095
|
Addressable::URI.parse("eXAMPLE://a/./b/../b/%63/%7bfoo%7d")
|
2954
3096
|
end
|
3097
|
+
|
3098
|
+
it "should have an origin of 'example://a'" do
|
3099
|
+
@uri.origin.should == 'example://a'
|
3100
|
+
end
|
2955
3101
|
end
|
2956
3102
|
|
2957
3103
|
describe Addressable::URI, "when parsed from " +
|
@@ -3006,6 +3152,10 @@ describe Addressable::URI, "when parsed from " +
|
|
3006
3152
|
it "should have no scheme" do
|
3007
3153
|
@uri.scheme.should == nil
|
3008
3154
|
end
|
3155
|
+
|
3156
|
+
it "should have a 'null' origin" do
|
3157
|
+
@uri.origin.should == 'null'
|
3158
|
+
end
|
3009
3159
|
end
|
3010
3160
|
|
3011
3161
|
describe Addressable::URI, "when parsed from " +
|
@@ -3021,6 +3171,10 @@ describe Addressable::URI, "when parsed from " +
|
|
3021
3171
|
it "should have a scheme of 'this'" do
|
3022
3172
|
@uri.scheme.should == "this"
|
3023
3173
|
end
|
3174
|
+
|
3175
|
+
it "should have a 'null' origin" do
|
3176
|
+
@uri.origin.should == 'null'
|
3177
|
+
end
|
3024
3178
|
end
|
3025
3179
|
|
3026
3180
|
describe Addressable::URI, "when parsed from '?'" do
|
@@ -3040,6 +3194,10 @@ describe Addressable::URI, "when parsed from '?'" do
|
|
3040
3194
|
it "should have the correct flat notation query values" do
|
3041
3195
|
@uri.query_values(:notation => :flat).should == {}
|
3042
3196
|
end
|
3197
|
+
|
3198
|
+
it "should have a 'null' origin" do
|
3199
|
+
@uri.origin.should == 'null'
|
3200
|
+
end
|
3043
3201
|
end
|
3044
3202
|
|
3045
3203
|
describe Addressable::URI, "when parsed from '?one=1&two=2&three=3'" do
|
@@ -3062,6 +3220,26 @@ describe Addressable::URI, "when parsed from '?one=1&two=2&three=3'" do
|
|
3062
3220
|
["one", "1"], ["two", "2"], ["three", "3"]
|
3063
3221
|
]
|
3064
3222
|
end
|
3223
|
+
|
3224
|
+
it "should have a 'null' origin" do
|
3225
|
+
@uri.origin.should == 'null'
|
3226
|
+
end
|
3227
|
+
end
|
3228
|
+
|
3229
|
+
describe Addressable::URI, "when parsed from '?one=1=uno&two=2=dos'" do
|
3230
|
+
before do
|
3231
|
+
@uri = Addressable::URI.parse("?one=1=uno&two=2=dos")
|
3232
|
+
end
|
3233
|
+
|
3234
|
+
it "should have the correct query values" do
|
3235
|
+
@uri.query_values.should == {"one" => "1=uno", "two" => "2=dos"}
|
3236
|
+
end
|
3237
|
+
|
3238
|
+
it "should have the correct flat array notation query values" do
|
3239
|
+
@uri.query_values(:notation => :flat_array).should == [
|
3240
|
+
["one", "1=uno"], ["two", "2=dos"]
|
3241
|
+
]
|
3242
|
+
end
|
3065
3243
|
end
|
3066
3244
|
|
3067
3245
|
describe Addressable::URI, "when parsed from '?one[two][three]=four'" do
|
@@ -3171,8 +3349,8 @@ describe Addressable::URI, "when parsed from " +
|
|
3171
3349
|
end
|
3172
3350
|
|
3173
3351
|
it "should have correct flat_array notation query values" do
|
3174
|
-
@uri.query_values(:notation => :flat_array).should ==
|
3175
|
-
[['one', 'two'], ['one', 'three']]
|
3352
|
+
@uri.query_values(:notation => :flat_array).should ==
|
3353
|
+
[['one', 'two'], ['one', 'three']]
|
3176
3354
|
end
|
3177
3355
|
end
|
3178
3356
|
|
@@ -3264,6 +3442,10 @@ describe Addressable::URI, "when parsed from " +
|
|
3264
3442
|
Addressable::URI.normalized_encode(@uri.to_s).should ==
|
3265
3443
|
"http://www.詹姆斯.com/"
|
3266
3444
|
end
|
3445
|
+
|
3446
|
+
it "should have an origin of 'http://www.xn--8ws00zhy3a.com'" do
|
3447
|
+
@uri.origin.should == 'http://www.xn--8ws00zhy3a.com'
|
3448
|
+
end
|
3267
3449
|
end
|
3268
3450
|
|
3269
3451
|
describe Addressable::URI, "when parsed from " +
|
@@ -3283,6 +3465,10 @@ describe Addressable::URI, "when parsed from " +
|
|
3283
3465
|
Addressable::URI.normalized_encode(@uri.to_s).should ==
|
3284
3466
|
"http://www.詹姆斯.com/%20some%20spaces%20/"
|
3285
3467
|
end
|
3468
|
+
|
3469
|
+
it "should have an origin of 'http://www.xn--8ws00zhy3a.com'" do
|
3470
|
+
@uri.origin.should == 'http://www.xn--8ws00zhy3a.com'
|
3471
|
+
end
|
3286
3472
|
end
|
3287
3473
|
|
3288
3474
|
describe Addressable::URI, "when parsed from " +
|
@@ -3302,6 +3488,10 @@ describe Addressable::URI, "when parsed from " +
|
|
3302
3488
|
display_string.encoding.to_s.should == Encoding::UTF_8.to_s
|
3303
3489
|
end
|
3304
3490
|
end
|
3491
|
+
|
3492
|
+
it "should have an origin of 'http://www.xn--8ws00zhy3a.com'" do
|
3493
|
+
@uri.origin.should == 'http://www.xn--8ws00zhy3a.com'
|
3494
|
+
end
|
3305
3495
|
end
|
3306
3496
|
|
3307
3497
|
describe Addressable::URI, "when parsed from " +
|
@@ -3339,6 +3529,13 @@ describe Addressable::URI, "when parsed from a percent-encoded IRI" do
|
|
3339
3529
|
"http://www.xn--n8jaaaaai5bhf7as8fsfk3jnknefdde3f" +
|
3340
3530
|
"g11amb5gzdb4wi9bya3kc6lra.w3.mag.keio.ac.jp/"
|
3341
3531
|
end
|
3532
|
+
|
3533
|
+
it "should have the correct origin" do
|
3534
|
+
@uri.origin.should == (
|
3535
|
+
"http://www.xn--n8jaaaaai5bhf7as8fsfk3jnknefdde3f" +
|
3536
|
+
"g11amb5gzdb4wi9bya3kc6lra.w3.mag.keio.ac.jp"
|
3537
|
+
)
|
3538
|
+
end
|
3342
3539
|
end
|
3343
3540
|
|
3344
3541
|
describe Addressable::URI, "with a base uri of 'http://a/b/c/d;p?q'" do
|
@@ -3671,6 +3868,11 @@ describe Addressable::URI, "when given a UNIX root directory" do
|
|
3671
3868
|
@uri = Addressable::URI.convert_path(@path)
|
3672
3869
|
@uri.to_str.should == "file:///"
|
3673
3870
|
end
|
3871
|
+
|
3872
|
+
it "should have an origin of 'file://'" do
|
3873
|
+
@uri = Addressable::URI.convert_path(@path)
|
3874
|
+
@uri.origin.should == 'file://'
|
3875
|
+
end
|
3674
3876
|
end
|
3675
3877
|
|
3676
3878
|
describe Addressable::URI, "when given a Windows root directory" do
|
@@ -3682,6 +3884,11 @@ describe Addressable::URI, "when given a Windows root directory" do
|
|
3682
3884
|
@uri = Addressable::URI.convert_path(@path)
|
3683
3885
|
@uri.to_str.should == "file:///c:/"
|
3684
3886
|
end
|
3887
|
+
|
3888
|
+
it "should have an origin of 'file://'" do
|
3889
|
+
@uri = Addressable::URI.convert_path(@path)
|
3890
|
+
@uri.origin.should == 'file://'
|
3891
|
+
end
|
3685
3892
|
end
|
3686
3893
|
|
3687
3894
|
describe Addressable::URI, "when given the path '/home/user/'" do
|
@@ -3694,6 +3901,11 @@ describe Addressable::URI, "when given the path '/home/user/'" do
|
|
3694
3901
|
@uri = Addressable::URI.convert_path(@path)
|
3695
3902
|
@uri.to_str.should == "file:///home/user/"
|
3696
3903
|
end
|
3904
|
+
|
3905
|
+
it "should have an origin of 'file://'" do
|
3906
|
+
@uri = Addressable::URI.convert_path(@path)
|
3907
|
+
@uri.origin.should == 'file://'
|
3908
|
+
end
|
3697
3909
|
end
|
3698
3910
|
|
3699
3911
|
describe Addressable::URI, "when given the path " +
|
@@ -3707,6 +3919,11 @@ describe Addressable::URI, "when given the path " +
|
|
3707
3919
|
@uri = Addressable::URI.convert_path(@path)
|
3708
3920
|
@uri.to_str.should == "file:///c:/windows/My%20Documents%20100%20/foo.txt"
|
3709
3921
|
end
|
3922
|
+
|
3923
|
+
it "should have an origin of 'file://'" do
|
3924
|
+
@uri = Addressable::URI.convert_path(@path)
|
3925
|
+
@uri.origin.should == 'file://'
|
3926
|
+
end
|
3710
3927
|
end
|
3711
3928
|
|
3712
3929
|
describe Addressable::URI, "when given the path " +
|
@@ -3720,6 +3937,11 @@ describe Addressable::URI, "when given the path " +
|
|
3720
3937
|
@uri = Addressable::URI.convert_path(@path)
|
3721
3938
|
@uri.to_str.should == "file:///c:/windows/My%20Documents%20100%20/foo.txt"
|
3722
3939
|
end
|
3940
|
+
|
3941
|
+
it "should have an origin of 'file://'" do
|
3942
|
+
@uri = Addressable::URI.convert_path(@path)
|
3943
|
+
@uri.origin.should == 'file://'
|
3944
|
+
end
|
3723
3945
|
end
|
3724
3946
|
|
3725
3947
|
describe Addressable::URI, "when given the path " +
|
@@ -3733,6 +3955,11 @@ describe Addressable::URI, "when given the path " +
|
|
3733
3955
|
@uri = Addressable::URI.convert_path(@path)
|
3734
3956
|
@uri.to_str.should == "file:///c:/windows/My%20Documents%20100%20/foo.txt"
|
3735
3957
|
end
|
3958
|
+
|
3959
|
+
it "should have an origin of 'file://'" do
|
3960
|
+
@uri = Addressable::URI.convert_path(@path)
|
3961
|
+
@uri.origin.should == 'file://'
|
3962
|
+
end
|
3736
3963
|
end
|
3737
3964
|
|
3738
3965
|
describe Addressable::URI, "when given the path " +
|
@@ -3746,6 +3973,11 @@ describe Addressable::URI, "when given the path " +
|
|
3746
3973
|
@uri = Addressable::URI.convert_path(@path)
|
3747
3974
|
@uri.to_str.should == "file:///c:/windows/My%20Documents%20100%20/foo.txt"
|
3748
3975
|
end
|
3976
|
+
|
3977
|
+
it "should have an origin of 'file://'" do
|
3978
|
+
@uri = Addressable::URI.convert_path(@path)
|
3979
|
+
@uri.origin.should == 'file://'
|
3980
|
+
end
|
3749
3981
|
end
|
3750
3982
|
|
3751
3983
|
describe Addressable::URI, "when given the path " +
|
@@ -3759,6 +3991,11 @@ describe Addressable::URI, "when given the path " +
|
|
3759
3991
|
@uri = Addressable::URI.convert_path(@path)
|
3760
3992
|
@uri.to_str.should == "file:///c:/windows/My%20Documents%20100%20/foo.txt"
|
3761
3993
|
end
|
3994
|
+
|
3995
|
+
it "should have an origin of 'file://'" do
|
3996
|
+
@uri = Addressable::URI.convert_path(@path)
|
3997
|
+
@uri.origin.should == 'file://'
|
3998
|
+
end
|
3762
3999
|
end
|
3763
4000
|
|
3764
4001
|
describe Addressable::URI, "when given an http protocol URI" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: addressable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 2.2.
|
9
|
+
- 4
|
10
|
+
version: 2.2.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Bob Aman
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-28 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|