addressable 2.4.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of addressable might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 77783a5c4c07f7a0862f0efaeb2619a278e32391
4
- data.tar.gz: 8edbb65fa242ce03cf2403c192d2358da64a095b
3
+ metadata.gz: 7327067f0dbb5a74d2da6ddff4227408af2f91aa
4
+ data.tar.gz: a2d86db5e9be6a83ba2e17c825fe4d30bfbac28f
5
5
  SHA512:
6
- metadata.gz: b3345827151e1d04e5c532cca1e8e63337b0ce9d9f0e276861ed6be95b114827f68d5f74e5bea857db1faaf7a70a928159436f5e51cbbecc4a6db64145d28ea2
7
- data.tar.gz: 86e4d5c946972502c8ac79bf2582d0d6894db23fa2e285c69b8dae0d1e16fcad447e7f8f393eeb9e9891f0a30e0971f864449b6dfaf4104bee080cfb3dfe4af4
6
+ metadata.gz: afd48eec1e6c38e64f34834cbac4af4f59464f66c9616a95ec74fc0f2c005d2c1c27046d6eccbdafb81d4e0bd974d9cd9fc40beb534911f2943f56c9bcc4da7b
7
+ data.tar.gz: 6a4de13abead387b0f31861e16887181a8fd686dcdb37f82f04a2fe69be91bdde5b34436269677b47477061d66d98192fbb31c67c1114b10e205c8f23b542d2b
@@ -1,3 +1,17 @@
1
+ # Addressable 2.5.0
2
+ - dropping support for Ruby 1.9
3
+ - adding support for Ruby 2.4 preview
4
+ - add support for public suffixes and tld; first runtime dependency
5
+ - hostname escaping should match RFC; underscores in hostnames no longer escaped
6
+ - paths beginning with // and missing an authority are now considered invalid
7
+ - validation now also takes place after setting a path
8
+ - handle backslashes in authority more like a browser for `heuristic_parse`
9
+ - unescaped backslashes in host now raise an `InvalidURIError`
10
+ - `merge!`, `join!`, `omit!` and `normalize!` don't disable deferred validation
11
+ - `heuristic_parse` now trims whitespace before parsing
12
+ - host parts longer than 63 bytes will be ignored and not passed to libidn
13
+ - normalized values always encoded as UTF-8
14
+
1
15
  # Addressable 2.4.0
2
16
  - support for 1.8.x dropped
3
17
  - double quotes in a host now raises an error
data/Gemfile CHANGED
@@ -2,8 +2,6 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'rake', '~> 10.4', '>= 10.4.2'
6
-
7
5
  group :test do
8
6
  gem 'rspec', '~> 3.0'
9
7
  gem 'rspec-its', '~> 1.1'
@@ -16,12 +14,19 @@ group :development do
16
14
  end
17
15
 
18
16
  group :test, :development do
17
+ gem 'rake', '> 10.0', '< 12'
19
18
  gem 'simplecov', :require => false
20
19
  gem 'coveralls', :require => false, :platforms => [
21
- :ruby_19, :ruby_20, :ruby_21, :rbx, :jruby
20
+ :ruby_20, :ruby_21, :ruby_22, :ruby_23
22
21
  ]
23
22
  # Used to test compatibility.
24
23
  gem 'rack-mount', git: 'https://github.com/sporkmonger/rack-mount.git', require: 'rack/mount'
24
+
25
+ if RUBY_VERSION.start_with?('2.0', '2.1')
26
+ gem 'rack', '< 2', :require => false
27
+ else
28
+ gem 'rack', :require => false
29
+ end
25
30
  end
26
31
 
27
- gem 'idn-ruby', :platform => [:mri_19, :mri_20, :mri_21, :mri_22]
32
+ gem 'idn-ruby', :platform => [:mri_20, :mri_21, :mri_22]
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  <dl>
4
4
  <dt>Homepage</dt><dd><a href="https://github.com/sporkmonger/addressable">github.com/sporkmonger/addressable</a></dd>
5
5
  <dt>Author</dt><dd><a href="mailto:bob@sporkmonger.com">Bob Aman</a></dd>
6
- <dt>Copyright</dt><dd>Copyright © 2006-2015 Bob Aman</dd>
6
+ <dt>Copyright</dt><dd>Copyright © Bob Aman</dd>
7
7
  <dt>License</dt><dd>Apache 2.0</dd>
8
8
  </dl>
9
9
 
@@ -92,7 +92,7 @@ template.extract(uri)
92
92
  # Install
93
93
 
94
94
  ```console
95
- $ sudo gem install addressable
95
+ $ gem install addressable
96
96
  ```
97
97
 
98
98
  You may optionally turn on native IDN support by installing libidn and the
@@ -103,3 +103,20 @@ $ sudo apt-get install idn # Debian/Ubuntu
103
103
  $ brew install libidn # OS X
104
104
  $ gem install idn-ruby
105
105
  ```
106
+
107
+ # Semantic Versioning
108
+
109
+ This project uses sementic versioning. You can (and should) specify your
110
+ dependency using a pessimistic version constraint covering the major and minor
111
+ values:
112
+
113
+ ```ruby
114
+ spec.add_dependency 'addressable', '~> 2.5'
115
+ ```
116
+
117
+ If you need a specific bug fix, you can also specify minimum tiny versions
118
+ without preventing updates to the latest minor release:
119
+
120
+ ```ruby
121
+ spec.add_dependency 'addressable', '~> 2.3', '>= 2.3.7'
122
+ ```
@@ -1,6 +1,6 @@
1
1
  # encoding:utf-8
2
2
  #--
3
- # Copyright (C) 2006-2015 Bob Aman
3
+ # Copyright (C) Bob Aman
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  # encoding:utf-8
2
2
  #--
3
- # Copyright (C) 2006-2015 Bob Aman
3
+ # Copyright (C) Bob Aman
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -34,8 +34,10 @@ module Addressable
34
34
 
35
35
  def self.to_ascii(value)
36
36
  value.to_s.split('.', -1).map do |segment|
37
- if segment.size > 0
37
+ if segment.size > 0 && segment.size < 64
38
38
  IDN::Idna.toASCII(segment)
39
+ elsif segment.size >= 64
40
+ segment
39
41
  else
40
42
  ''
41
43
  end
@@ -44,8 +46,10 @@ module Addressable
44
46
 
45
47
  def self.to_unicode(value)
46
48
  value.to_s.split('.', -1).map do |segment|
47
- if segment.size > 0
49
+ if segment.size > 0 && segment.size < 64
48
50
  IDN::Idna.toUnicode(segment)
51
+ elsif segment.size >= 64
52
+ segment
49
53
  else
50
54
  ''
51
55
  end
@@ -1,6 +1,6 @@
1
1
  # encoding:utf-8
2
2
  #--
3
- # Copyright (C) 2006-2015 Bob Aman
3
+ # Copyright (C) Bob Aman
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -94,7 +94,12 @@ module Addressable
94
94
  parts = input.split('.')
95
95
  parts.map! do |part|
96
96
  if part =~ /^#{ACE_PREFIX}(.+)/
97
- punycode_decode(part[/^#{ACE_PREFIX}(.+)/, 1])
97
+ begin
98
+ punycode_decode(part[/^#{ACE_PREFIX}(.+)/, 1])
99
+ rescue Addressable::IDNA::PunycodeBadInput
100
+ # toUnicode is explicitly defined as never-fails by the spec
101
+ part
102
+ end
98
103
  else
99
104
  part
100
105
  end
@@ -1,6 +1,6 @@
1
1
  # encoding:utf-8
2
2
  #--
3
- # Copyright (C) 2006-2015 Bob Aman
3
+ # Copyright (C) Bob Aman
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  # encoding:utf-8
2
2
  #--
3
- # Copyright (C) 2006-2015 Bob Aman
3
+ # Copyright (C) Bob Aman
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
18
18
 
19
19
  require "addressable/version"
20
20
  require "addressable/idna"
21
+ require "public_suffix"
21
22
 
22
23
  ##
23
24
  # Addressable is a library for processing links and URIs.
@@ -44,7 +45,7 @@ module Addressable
44
45
  UNRESERVED = ALPHA + DIGIT + "\\-\\.\\_\\~"
45
46
  PCHAR = UNRESERVED + SUB_DELIMS + "\\:\\@"
46
47
  SCHEME = ALPHA + DIGIT + "\\-\\+\\."
47
- HOST = ALPHA + DIGIT + "\\-\\.\\[\\:\\]"
48
+ HOST = UNRESERVED + SUB_DELIMS + "\\[\\:\\]"
48
49
  AUTHORITY = PCHAR
49
50
  PATH = PCHAR + "\\/"
50
51
  QUERY = PCHAR + "\\/\\?"
@@ -176,7 +177,7 @@ module Addressable
176
177
  raise TypeError, "Can't convert #{uri.class} into String."
177
178
  end
178
179
  # Otherwise, convert to a String
179
- uri = uri.to_str.dup
180
+ uri = uri.to_str.dup.strip
180
181
  hints = {
181
182
  :scheme => "http"
182
183
  }.merge(hints)
@@ -194,6 +195,15 @@ module Addressable
194
195
  when /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/
195
196
  uri.gsub!(/^/, hints[:scheme] + "://")
196
197
  end
198
+ match = uri.match(URIREGEX)
199
+ fragments = match.captures
200
+ authority = fragments[3]
201
+ if authority && authority.length > 0
202
+ new_authority = authority.gsub(/\\/, '/').gsub(/ /, '%20')
203
+ # NOTE: We want offset 4, not 3!
204
+ offset = match.offset(4)
205
+ uri[offset[0]...offset[1]] = new_authority
206
+ end
197
207
  parsed = self.parse(uri)
198
208
  if parsed.scheme =~ /^[^\/?#\.]+\.[^\/?#]+$/
199
209
  parsed = self.parse(hints[:scheme] + "://" + uri)
@@ -367,12 +377,10 @@ module Addressable
367
377
  if character_class.kind_of?(String)
368
378
  character_class = /[^#{character_class}]/
369
379
  end
370
- if component.respond_to?(:force_encoding)
371
- # We can't perform regexps on invalid UTF sequences, but
372
- # here we need to, so switch to ASCII.
373
- component = component.dup
374
- component.force_encoding(Encoding::ASCII_8BIT)
375
- end
380
+ # We can't perform regexps on invalid UTF sequences, but
381
+ # here we need to, so switch to ASCII.
382
+ component = component.dup
383
+ component.force_encoding(Encoding::ASCII_8BIT)
376
384
  # Avoiding gsub! because there are edge cases with frozen strings
377
385
  component = component.gsub(character_class) do |sequence|
378
386
  (sequence.unpack('C*').map { |c| "%" + ("%02x" % c).upcase }).join
@@ -427,14 +435,14 @@ module Addressable
427
435
  end
428
436
  uri = uri.dup
429
437
  # Seriously, only use UTF-8. I'm really not kidding!
430
- uri.force_encoding("utf-8") if uri.respond_to?(:force_encoding)
431
- leave_encoded.force_encoding("utf-8") if leave_encoded.respond_to?(:force_encoding)
438
+ uri.force_encoding("utf-8")
439
+ leave_encoded.force_encoding("utf-8")
432
440
  result = uri.gsub(/%[0-9a-f]{2}/iu) do |sequence|
433
441
  c = sequence[1..3].to_i(16).chr
434
- c.force_encoding("utf-8") if c.respond_to?(:force_encoding)
442
+ c.force_encoding("utf-8")
435
443
  leave_encoded.include?(c) ? sequence : c
436
444
  end
437
- result.force_encoding("utf-8") if result.respond_to?(:force_encoding)
445
+ result.force_encoding("utf-8")
438
446
  if return_type == String
439
447
  return result
440
448
  elsif return_type == ::Addressable::URI
@@ -521,12 +529,10 @@ module Addressable
521
529
 
522
530
  character_class = /[^#{character_class}]#{leave_re}/
523
531
  end
524
- if component.respond_to?(:force_encoding)
525
- # We can't perform regexps on invalid UTF sequences, but
526
- # here we need to, so switch to ASCII.
527
- component = component.dup
528
- component.force_encoding(Encoding::ASCII_8BIT)
529
- end
532
+ # We can't perform regexps on invalid UTF sequences, but
533
+ # here we need to, so switch to ASCII.
534
+ component = component.dup
535
+ component.force_encoding(Encoding::ASCII_8BIT)
530
536
  unencoded = self.unencode_component(component, String, leave_encoded)
531
537
  begin
532
538
  encoded = self.encode_component(
@@ -537,9 +543,7 @@ module Addressable
537
543
  rescue ArgumentError
538
544
  encoded = self.encode_component(unencoded)
539
545
  end
540
- if encoded.respond_to?(:force_encoding)
541
- encoded.force_encoding(Encoding::UTF_8)
542
- end
546
+ encoded.force_encoding(Encoding::UTF_8)
543
547
  return encoded
544
548
  end
545
549
 
@@ -851,6 +855,9 @@ module Addressable
851
855
  )
852
856
  end
853
857
  end
858
+ # All normalized values should be UTF-8
859
+ @normalized_scheme.force_encoding(Encoding::UTF_8) if @normalized_scheme
860
+ @normalized_scheme
854
861
  end
855
862
 
856
863
  ##
@@ -903,6 +910,9 @@ module Addressable
903
910
  )
904
911
  end
905
912
  end
913
+ # All normalized values should be UTF-8
914
+ @normalized_user.force_encoding(Encoding::UTF_8) if @normalized_user
915
+ @normalized_user
906
916
  end
907
917
 
908
918
  ##
@@ -957,6 +967,11 @@ module Addressable
957
967
  )
958
968
  end
959
969
  end
970
+ # All normalized values should be UTF-8
971
+ if @normalized_password
972
+ @normalized_password.force_encoding(Encoding::UTF_8)
973
+ end
974
+ @normalized_password
960
975
  end
961
976
 
962
977
  ##
@@ -1022,6 +1037,11 @@ module Addressable
1022
1037
  "#{current_user}"
1023
1038
  end
1024
1039
  end
1040
+ # All normalized values should be UTF-8
1041
+ if @normalized_userinfo
1042
+ @normalized_userinfo.force_encoding(Encoding::UTF_8)
1043
+ end
1044
+ @normalized_userinfo
1025
1045
  end
1026
1046
 
1027
1047
  ##
@@ -1084,6 +1104,9 @@ module Addressable
1084
1104
  EMPTY_STR
1085
1105
  end
1086
1106
  end
1107
+ # All normalized values should be UTF-8
1108
+ @normalized_host.force_encoding(Encoding::UTF_8) if @normalized_host
1109
+ @normalized_host
1087
1110
  end
1088
1111
 
1089
1112
  ##
@@ -1096,14 +1119,6 @@ module Addressable
1096
1119
  end
1097
1120
  @host = new_host ? new_host.to_str : nil
1098
1121
 
1099
- unreserved = CharacterClasses::UNRESERVED
1100
- sub_delims = CharacterClasses::SUB_DELIMS
1101
- if !@host.nil? && (@host =~ /[<>{}\/\?\#\@"[[:space:]]]/ ||
1102
- (@host[/^\[(.*)\]$/, 1] != nil && @host[/^\[(.*)\]$/, 1] !~
1103
- Regexp.new("^[#{unreserved}#{sub_delims}:]*$")))
1104
- raise InvalidURIError, "Invalid character in host: '#{@host.to_s}'"
1105
- end
1106
-
1107
1122
  # Reset dependent values
1108
1123
  remove_instance_variable(:@authority) if defined?(@authority)
1109
1124
  remove_instance_variable(:@normalized_host) if defined?(@normalized_host)
@@ -1144,6 +1159,24 @@ module Addressable
1144
1159
  self.host = v
1145
1160
  end
1146
1161
 
1162
+ ##
1163
+ # Returns the top-level domain for this host.
1164
+ #
1165
+ # @example
1166
+ # Addressable::URI.parse("www.example.co.uk").tld # => "co.uk"
1167
+ def tld
1168
+ PublicSuffix.parse(self.host, ignore_private: true).tld
1169
+ end
1170
+
1171
+ ##
1172
+ # Returns the public suffix domain for this host.
1173
+ #
1174
+ # @example
1175
+ # Addressable::URI.parse("www.example.co.uk").domain # => "example.co.uk"
1176
+ def domain
1177
+ PublicSuffix.domain(self.host, ignore_private: true)
1178
+ end
1179
+
1147
1180
  ##
1148
1181
  # The authority component for this URI.
1149
1182
  # Combines the user, password, host, and port components.
@@ -1151,7 +1184,7 @@ module Addressable
1151
1184
  # @return [String] The authority component.
1152
1185
  def authority
1153
1186
  self.host && @authority ||= begin
1154
- authority = ""
1187
+ authority = String.new
1155
1188
  if self.userinfo != nil
1156
1189
  authority << "#{self.userinfo}@"
1157
1190
  end
@@ -1170,7 +1203,7 @@ module Addressable
1170
1203
  def normalized_authority
1171
1204
  return nil unless self.authority
1172
1205
  @normalized_authority ||= begin
1173
- authority = ""
1206
+ authority = String.new
1174
1207
  if self.normalized_userinfo != nil
1175
1208
  authority << "#{self.normalized_userinfo}@"
1176
1209
  end
@@ -1180,6 +1213,11 @@ module Addressable
1180
1213
  end
1181
1214
  authority
1182
1215
  end
1216
+ # All normalized values should be UTF-8
1217
+ if @normalized_authority
1218
+ @normalized_authority.force_encoding(Encoding::UTF_8)
1219
+ end
1220
+ @normalized_authority
1183
1221
  end
1184
1222
 
1185
1223
  ##
@@ -1411,6 +1449,9 @@ module Addressable
1411
1449
  end
1412
1450
  site_string
1413
1451
  end
1452
+ # All normalized values should be UTF-8
1453
+ @normalized_site.force_encoding(Encoding::UTF_8) if @normalized_site
1454
+ @normalized_site
1414
1455
  end
1415
1456
 
1416
1457
  ##
@@ -1471,6 +1512,9 @@ module Addressable
1471
1512
  end
1472
1513
  result
1473
1514
  end
1515
+ # All normalized values should be UTF-8
1516
+ @normalized_path.force_encoding(Encoding::UTF_8) if @normalized_path
1517
+ @normalized_path
1474
1518
  end
1475
1519
 
1476
1520
  ##
@@ -1489,6 +1533,9 @@ module Addressable
1489
1533
  # Reset dependent values
1490
1534
  remove_instance_variable(:@normalized_path) if defined?(@normalized_path)
1491
1535
  remove_composite_values
1536
+
1537
+ # Ensure we haven't created an invalid URI
1538
+ validate()
1492
1539
  end
1493
1540
 
1494
1541
  ##
@@ -1536,6 +1583,9 @@ module Addressable
1536
1583
  end.join("&")
1537
1584
  component == "" ? nil : component
1538
1585
  end
1586
+ # All normalized values should be UTF-8
1587
+ @normalized_query.force_encoding(Encoding::UTF_8) if @normalized_query
1588
+ @normalized_query
1539
1589
  end
1540
1590
 
1541
1591
  ##
@@ -1727,6 +1777,11 @@ module Addressable
1727
1777
  )
1728
1778
  component == "" ? nil : component
1729
1779
  end
1780
+ # All normalized values should be UTF-8
1781
+ if @normalized_fragment
1782
+ @normalized_fragment.force_encoding(Encoding::UTF_8)
1783
+ end
1784
+ @normalized_fragment
1730
1785
  end
1731
1786
 
1732
1787
  ##
@@ -2246,15 +2301,13 @@ module Addressable
2246
2301
  "Cannot assemble URI string with ambiguous path: '#{self.path}'"
2247
2302
  end
2248
2303
  @uri_string ||= begin
2249
- uri_string = ""
2304
+ uri_string = String.new
2250
2305
  uri_string << "#{self.scheme}:" if self.scheme != nil
2251
2306
  uri_string << "//#{self.authority}" if self.authority != nil
2252
2307
  uri_string << self.path.to_s
2253
2308
  uri_string << "?#{self.query}" if self.query != nil
2254
2309
  uri_string << "##{self.fragment}" if self.fragment != nil
2255
- if uri_string.respond_to?(:force_encoding)
2256
- uri_string.force_encoding(Encoding::UTF_8)
2257
- end
2310
+ uri_string.force_encoding(Encoding::UTF_8)
2258
2311
  uri_string
2259
2312
  end
2260
2313
  end
@@ -2371,6 +2424,19 @@ module Addressable
2371
2424
  raise InvalidURIError,
2372
2425
  "Cannot have a relative path with an authority set: '#{self.to_s}'"
2373
2426
  end
2427
+ if self.path != nil && !self.path.empty? &&
2428
+ self.path[0..1] == SLASH + SLASH && self.authority == nil
2429
+ raise InvalidURIError,
2430
+ "Cannot have a path with two leading slashes " +
2431
+ "without an authority set: '#{self.to_s}'"
2432
+ end
2433
+ unreserved = CharacterClasses::UNRESERVED
2434
+ sub_delims = CharacterClasses::SUB_DELIMS
2435
+ if !self.host.nil? && (self.host =~ /[<>{}\/\\\?\#\@"[[:space:]]]/ ||
2436
+ (self.host[/^\[(.*)\]$/, 1] != nil && self.host[/^\[(.*)\]$/, 1] !~
2437
+ Regexp.new("^[#{unreserved}#{sub_delims}:]*$")))
2438
+ raise InvalidURIError, "Invalid character in host: '#{self.host.to_s}'"
2439
+ end
2374
2440
  return nil
2375
2441
  end
2376
2442
 
@@ -2384,7 +2450,9 @@ module Addressable
2384
2450
  def replace_self(uri)
2385
2451
  # Reset dependent values
2386
2452
  instance_variables.each do |var|
2387
- remove_instance_variable(var) if instance_variable_defined?(var)
2453
+ if instance_variable_defined?(var) && var != :@validation_deferred
2454
+ remove_instance_variable(var)
2455
+ end
2388
2456
  end
2389
2457
 
2390
2458
  @scheme = uri.scheme
@@ -1,6 +1,6 @@
1
1
  # encoding:utf-8
2
2
  #--
3
- # Copyright (C) 2006-2015 Bob Aman
3
+ # Copyright (C) Bob Aman
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -21,7 +21,7 @@ if !defined?(Addressable::VERSION)
21
21
  module Addressable
22
22
  module VERSION
23
23
  MAJOR = 2
24
- MINOR = 4
24
+ MINOR = 5
25
25
  TINY = 0
26
26
 
27
27
  STRING = [MAJOR, MINOR, TINY].join('.')
@@ -1,5 +1,5 @@
1
1
  # coding: utf-8
2
- # Copyright (C) 2006-2015 Bob Aman
2
+ # Copyright (C) Bob Aman
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -26,6 +26,11 @@ shared_examples_for "converting from unicode to ASCII" do
26
26
  expect(Addressable::IDNA.to_ascii("www.google.com")).to eq("www.google.com")
27
27
  end
28
28
 
29
+ LONG = 'AcinusFallumTrompetumNullunCreditumVisumEstAtCuadLongumEtCefallum.com'
30
+ it "should convert '#{LONG}' correctly" do
31
+ expect(Addressable::IDNA.to_ascii(LONG)).to eq(LONG)
32
+ end
33
+
29
34
  it "should convert 'www.詹姆斯.com' correctly" do
30
35
  expect(Addressable::IDNA.to_ascii(
31
36
  "www.詹姆斯.com"
@@ -137,12 +142,23 @@ shared_examples_for "converting from unicode to ASCII" do
137
142
  end
138
143
 
139
144
  shared_examples_for "converting from ASCII to unicode" do
145
+ LONG = 'AcinusFallumTrompetumNullunCreditumVisumEstAtCuadLongumEtCefallum.com'
146
+ it "should convert '#{LONG}' correctly" do
147
+ expect(Addressable::IDNA.to_unicode(LONG)).to eq(LONG)
148
+ end
149
+
150
+ it "should return the identity conversion when punycode decode fails" do
151
+ expect(Addressable::IDNA.to_unicode("xn--zckp1cyg1.sblo.jp")).to eq(
152
+ "xn--zckp1cyg1.sblo.jp")
153
+ end
154
+
140
155
  it "should return the identity conversion when the ACE prefix has no suffix" do
141
156
  expect(Addressable::IDNA.to_unicode("xn--...-")).to eq("xn--...-")
142
157
  end
143
158
 
144
159
  it "should convert 'www.google.com' correctly" do
145
- expect(Addressable::IDNA.to_unicode("www.google.com")).to eq("www.google.com")
160
+ expect(Addressable::IDNA.to_unicode("www.google.com")).to eq(
161
+ "www.google.com")
146
162
  end
147
163
 
148
164
  it "should convert 'www.詹姆斯.com' correctly" do
@@ -1,5 +1,5 @@
1
1
  # coding: utf-8
2
- # Copyright (C) 2006-2015 Bob Aman
2
+ # Copyright (C) Bob Aman
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  # coding: utf-8
2
- # Copyright (C) 2006-2015 Bob Aman
2
+ # Copyright (C) Bob Aman
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  # coding: utf-8
2
- # Copyright (C) 2006-2015 Bob Aman
2
+ # Copyright (C) Bob Aman
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  # coding: utf-8
2
- # Copyright (C) 2006-2015 Bob Aman
2
+ # Copyright (C) Bob Aman
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -851,6 +851,7 @@ describe Addressable::Template do
851
851
  expect(match_data.uri).to eq(uri)
852
852
  expect(match_data.template).to eq(subject)
853
853
  expect(match_data.mapping).to be_empty
854
+ expect(match_data.inspect).to be_an String
854
855
  end
855
856
  end
856
857
  end
@@ -1,5 +1,5 @@
1
1
  # coding: utf-8
2
- # Copyright (C) 2006-2015 Bob Aman
2
+ # Copyright (C) Bob Aman
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -409,6 +409,10 @@ describe Addressable::URI, "when initialized from individual components" do
409
409
  expect(@uri.normalized_host).to eq("example.com")
410
410
  end
411
411
 
412
+ it "returns 'com' for #tld" do
413
+ expect(@uri.tld).to eq("com")
414
+ end
415
+
412
416
  it "returns 'user:password@example.com:8080' for #authority" do
413
417
  expect(@uri.authority).to eq("user:password@example.com:8080")
414
418
  end
@@ -1073,6 +1077,30 @@ describe Addressable::URI, "when created with a host with trailing dots" do
1073
1077
  end
1074
1078
  end
1075
1079
 
1080
+ describe Addressable::URI, "when created with a host with a backslash" do
1081
+ it "should raise an error" do
1082
+ expect(lambda do
1083
+ Addressable::URI.new(:authority => "example\\example")
1084
+ end).to raise_error(Addressable::URI::InvalidURIError)
1085
+ end
1086
+ end
1087
+
1088
+ describe Addressable::URI, "when created with a host with a slash" do
1089
+ it "should raise an error" do
1090
+ expect(lambda do
1091
+ Addressable::URI.new(:authority => "example/example")
1092
+ end).to raise_error(Addressable::URI::InvalidURIError)
1093
+ end
1094
+ end
1095
+
1096
+ describe Addressable::URI, "when created with a host with a space" do
1097
+ it "should raise an error" do
1098
+ expect(lambda do
1099
+ Addressable::URI.new(:authority => "example example")
1100
+ end).to raise_error(Addressable::URI::InvalidURIError)
1101
+ end
1102
+ end
1103
+
1076
1104
  describe Addressable::URI, "when created with both a userinfo and a user" do
1077
1105
  it "should raise an error" do
1078
1106
  expect(lambda do
@@ -1775,7 +1803,7 @@ describe Addressable::URI, "when parsed from " +
1775
1803
  end
1776
1804
 
1777
1805
  it "should have the same hash as http://EXAMPLE.com after assignment" do
1778
- @uri.host = "EXAMPLE.com"
1806
+ @uri.origin = "http://EXAMPLE.com"
1779
1807
  expect(@uri.hash).to eq(Addressable::URI.parse("http://EXAMPLE.com").hash)
1780
1808
  end
1781
1809
 
@@ -1783,6 +1811,24 @@ describe Addressable::URI, "when parsed from " +
1783
1811
  expect(@uri.hash).not_to eq(Addressable::URI.parse("http://EXAMPLE.com").hash)
1784
1812
  end
1785
1813
 
1814
+ it "should not allow origin assignment without scheme" do
1815
+ expect(lambda do
1816
+ @uri.origin = "example.com"
1817
+ end).to raise_error(Addressable::URI::InvalidURIError)
1818
+ end
1819
+
1820
+ it "should not allow origin assignment without host" do
1821
+ expect(lambda do
1822
+ @uri.origin = "http://"
1823
+ end).to raise_error(Addressable::URI::InvalidURIError)
1824
+ end
1825
+
1826
+ it "should not allow origin assignment with bogus type" do
1827
+ expect(lambda do
1828
+ @uri.origin = :bogus
1829
+ end).to raise_error(TypeError)
1830
+ end
1831
+
1786
1832
  # Section 6.2.3 of RFC 3986
1787
1833
  it "should be equivalent to http://example.com/" do
1788
1834
  expect(@uri).to eq(Addressable::URI.parse("http://example.com/"))
@@ -2320,6 +2366,80 @@ describe Addressable::URI, "when parsed from " +
2320
2366
  end
2321
2367
  end
2322
2368
 
2369
+ describe Addressable::URI, "when parsed from " +
2370
+ "'HTTP://EXAMPLE.COM/'" do
2371
+ before do
2372
+ @uri = Addressable::URI.parse("HTTP://EXAMPLE.COM/")
2373
+ end
2374
+
2375
+ it "should be equivalent to http://example.com" do
2376
+ expect(@uri).to eq(Addressable::URI.parse("http://example.com"))
2377
+ end
2378
+
2379
+ it "should correctly convert to a hash" do
2380
+ expect(@uri.to_hash).to eq({
2381
+ :scheme => "HTTP",
2382
+ :user => nil,
2383
+ :password => nil,
2384
+ :host => "EXAMPLE.COM",
2385
+ :port => nil,
2386
+ :path => "/",
2387
+ :query => nil,
2388
+ :fragment => nil
2389
+ })
2390
+ end
2391
+
2392
+ it "should be identical to its duplicate" do
2393
+ expect(@uri).to eq(@uri.dup)
2394
+ end
2395
+
2396
+ it "should have an origin of 'http://example.com'" do
2397
+ expect(@uri.origin).to eq('http://example.com')
2398
+ end
2399
+
2400
+ it "should have a tld of 'com'" do
2401
+ expect(@uri.tld).to eq('com')
2402
+ end
2403
+ end
2404
+
2405
+ describe Addressable::URI, "when parsed from " +
2406
+ "'http://www.example.co.uk/'" do
2407
+ before do
2408
+ @uri = Addressable::URI.parse("http://www.example.co.uk/")
2409
+ end
2410
+
2411
+ it "should have an origin of 'http://www.example.co.uk'" do
2412
+ expect(@uri.origin).to eq('http://www.example.co.uk')
2413
+ end
2414
+
2415
+ it "should have a tld of 'co.uk'" do
2416
+ expect(@uri.tld).to eq('co.uk')
2417
+ end
2418
+
2419
+ it "should have a domain of 'example.co.uk'" do
2420
+ expect(@uri.domain).to eq('example.co.uk')
2421
+ end
2422
+ end
2423
+
2424
+ describe Addressable::URI, "when parsed from " +
2425
+ "'http://sub_domain.blogspot.com/'" do
2426
+ before do
2427
+ @uri = Addressable::URI.parse("http://sub_domain.blogspot.com/")
2428
+ end
2429
+
2430
+ it "should have an origin of 'http://sub_domain.blogspot.com'" do
2431
+ expect(@uri.origin).to eq('http://sub_domain.blogspot.com')
2432
+ end
2433
+
2434
+ it "should have a tld of 'com'" do
2435
+ expect(@uri.tld).to eq('com')
2436
+ end
2437
+
2438
+ it "should have a domain of 'blogspot.com'" do
2439
+ expect(@uri.domain).to eq('blogspot.com')
2440
+ end
2441
+ end
2442
+
2323
2443
  describe Addressable::URI, "when parsed from " +
2324
2444
  "'http://example.com/~smith/'" do
2325
2445
  before do
@@ -2961,6 +3081,23 @@ describe Addressable::URI, "when parsed from " +
2961
3081
  end
2962
3082
  end
2963
3083
 
3084
+ describe Addressable::URI, "when parsed from " +
3085
+ "'/..//example.com'" do
3086
+ before do
3087
+ @uri = Addressable::URI.parse("/..//example.com")
3088
+ end
3089
+
3090
+ it "should become invalid when normalized" do
3091
+ expect(lambda do
3092
+ @uri.normalize
3093
+ end).to raise_error(Addressable::URI::InvalidURIError, /authority/)
3094
+ end
3095
+
3096
+ it "should have a path of '/..//example.com'" do
3097
+ expect(@uri.path).to eq("/..//example.com")
3098
+ end
3099
+ end
3100
+
2964
3101
  describe Addressable::URI, "when parsed from '/a/b/c/./../../g'" do
2965
3102
  before do
2966
3103
  @uri = Addressable::URI.parse("/a/b/c/./../../g")
@@ -5476,7 +5613,7 @@ describe Addressable::URI, "when parsing a non-String object" do
5476
5613
  it "should raise a TypeError for objects than cannot be converted" do
5477
5614
  expect(lambda do
5478
5615
  Addressable::URI.parse(42)
5479
- end).to raise_error(TypeError, "Can't convert Fixnum into String.")
5616
+ end).to raise_error(TypeError)
5480
5617
  end
5481
5618
 
5482
5619
  it "should correctly parse heuristically anything with a 'to_str' method" do
@@ -5486,7 +5623,7 @@ describe Addressable::URI, "when parsing a non-String object" do
5486
5623
  it "should raise a TypeError for objects than cannot be converted" do
5487
5624
  expect(lambda do
5488
5625
  Addressable::URI.heuristic_parse(42)
5489
- end).to raise_error(TypeError, "Can't convert Fixnum into String.")
5626
+ end).to raise_error(TypeError)
5490
5627
  end
5491
5628
  end
5492
5629
 
@@ -5532,7 +5669,7 @@ describe Addressable::URI, "when form encoding a non-Array object" do
5532
5669
  it "should raise a TypeError for objects than cannot be converted" do
5533
5670
  expect(lambda do
5534
5671
  Addressable::URI.form_encode(42)
5535
- end).to raise_error(TypeError, "Can't convert Fixnum into Array.")
5672
+ end).to raise_error(TypeError)
5536
5673
  end
5537
5674
  end
5538
5675
 
@@ -5600,7 +5737,7 @@ describe Addressable::URI, "when form unencoding a non-String object" do
5600
5737
  it "should raise a TypeError for objects than cannot be converted" do
5601
5738
  expect(lambda do
5602
5739
  Addressable::URI.form_unencode(42)
5603
- end).to raise_error(TypeError, "Can't convert Fixnum into String.")
5740
+ end).to raise_error(TypeError)
5604
5741
  end
5605
5742
  end
5606
5743
 
@@ -5612,7 +5749,7 @@ describe Addressable::URI, "when normalizing a non-String object" do
5612
5749
  it "should raise a TypeError for objects than cannot be converted" do
5613
5750
  expect(lambda do
5614
5751
  Addressable::URI.normalize_component(42)
5615
- end).to raise_error(TypeError, "Can't convert Fixnum into String.")
5752
+ end).to raise_error(TypeError)
5616
5753
  end
5617
5754
 
5618
5755
  it "should raise a TypeError for objects than cannot be converted" do
@@ -5878,6 +6015,136 @@ describe Addressable::URI, "when given the input " +
5878
6015
  end
5879
6016
  end
5880
6017
 
6018
+ describe Addressable::URI, "when given the input " +
6019
+ "'http://prefix\\.example.com/'" do
6020
+ before do
6021
+ @input = "http://prefix\\.example.com/"
6022
+ end
6023
+
6024
+ it "should heuristically parse to 'http://prefix/.example.com/'" do
6025
+ @uri = Addressable::URI.heuristic_parse(@input)
6026
+ expect(@uri.authority).to eq("prefix")
6027
+ expect(@uri.to_s).to eq("http://prefix/.example.com/")
6028
+ end
6029
+
6030
+ it "should heuristically parse to 'http://prefix/.example.com/' " +
6031
+ "even with a scheme hint of 'ftp'" do
6032
+ @uri = Addressable::URI.heuristic_parse(@input, {:scheme => 'ftp'})
6033
+ expect(@uri.to_s).to eq("http://prefix/.example.com/")
6034
+ end
6035
+ end
6036
+
6037
+ describe Addressable::URI, "when given the input " +
6038
+ "'http://p:\\/'" do
6039
+ before do
6040
+ @input = "http://p:\\/"
6041
+ end
6042
+
6043
+ it "should heuristically parse to 'http://p//'" do
6044
+ @uri = Addressable::URI.heuristic_parse(@input)
6045
+ expect(@uri.authority).to eq("p")
6046
+ expect(@uri.to_s).to eq("http://p//")
6047
+ end
6048
+
6049
+ it "should heuristically parse to 'http://p//' " +
6050
+ "even with a scheme hint of 'ftp'" do
6051
+ @uri = Addressable::URI.heuristic_parse(@input, {:scheme => 'ftp'})
6052
+ expect(@uri.to_s).to eq("http://p//")
6053
+ end
6054
+ end
6055
+
6056
+ describe Addressable::URI, "when given the input " +
6057
+ "'http://p://'" do
6058
+ before do
6059
+ @input = "http://p://"
6060
+ end
6061
+
6062
+ it "should heuristically parse to 'http://p//'" do
6063
+ @uri = Addressable::URI.heuristic_parse(@input)
6064
+ expect(@uri.authority).to eq("p")
6065
+ expect(@uri.to_s).to eq("http://p//")
6066
+ end
6067
+
6068
+ it "should heuristically parse to 'http://p//' " +
6069
+ "even with a scheme hint of 'ftp'" do
6070
+ @uri = Addressable::URI.heuristic_parse(@input, {:scheme => 'ftp'})
6071
+ expect(@uri.to_s).to eq("http://p//")
6072
+ end
6073
+ end
6074
+
6075
+ describe Addressable::URI, "when given the input " +
6076
+ "'http://p://p'" do
6077
+ before do
6078
+ @input = "http://p://p"
6079
+ end
6080
+
6081
+ it "should heuristically parse to 'http://p//p'" do
6082
+ @uri = Addressable::URI.heuristic_parse(@input)
6083
+ expect(@uri.authority).to eq("p")
6084
+ expect(@uri.to_s).to eq("http://p//p")
6085
+ end
6086
+
6087
+ it "should heuristically parse to 'http://p//p' " +
6088
+ "even with a scheme hint of 'ftp'" do
6089
+ @uri = Addressable::URI.heuristic_parse(@input, {:scheme => 'ftp'})
6090
+ expect(@uri.to_s).to eq("http://p//p")
6091
+ end
6092
+ end
6093
+
6094
+ describe Addressable::URI, "when given the input " +
6095
+ "'http://prefix .example.com/'" do
6096
+ before do
6097
+ @input = "http://prefix .example.com/"
6098
+ end
6099
+
6100
+ # Justification here being that no browser actually tries to resolve this.
6101
+ # They all treat this as a web search.
6102
+ it "should heuristically parse to 'http://prefix%20.example.com/'" do
6103
+ @uri = Addressable::URI.heuristic_parse(@input)
6104
+ expect(@uri.authority).to eq("prefix%20.example.com")
6105
+ expect(@uri.to_s).to eq("http://prefix%20.example.com/")
6106
+ end
6107
+
6108
+ it "should heuristically parse to 'http://prefix%20.example.com/' " +
6109
+ "even with a scheme hint of 'ftp'" do
6110
+ @uri = Addressable::URI.heuristic_parse(@input, {:scheme => 'ftp'})
6111
+ expect(@uri.to_s).to eq("http://prefix%20.example.com/")
6112
+ end
6113
+ end
6114
+
6115
+ describe Addressable::URI, "when given the input " +
6116
+ "' http://www.example.com/ '" do
6117
+ before do
6118
+ @input = " http://www.example.com/ "
6119
+ end
6120
+
6121
+ it "should heuristically parse to 'http://prefix%20.example.com/'" do
6122
+ @uri = Addressable::URI.heuristic_parse(@input)
6123
+ expect(@uri.scheme).to eq("http")
6124
+ expect(@uri.path).to eq("/")
6125
+ expect(@uri.to_s).to eq("http://www.example.com/")
6126
+ end
6127
+ end
6128
+
6129
+ describe Addressable::URI, "when given the input " +
6130
+ "'http://prefix%2F.example.com/'" do
6131
+ before do
6132
+ @input = "http://prefix%2F.example.com/"
6133
+ end
6134
+
6135
+ it "should heuristically parse to 'http://prefix%2F.example.com/'" do
6136
+ @uri = Addressable::URI.heuristic_parse(@input)
6137
+ expect(@uri.authority).to eq("prefix%2F.example.com")
6138
+ expect(@uri.to_s).to eq("http://prefix%2F.example.com/")
6139
+ end
6140
+
6141
+ it "should heuristically parse to 'http://prefix%2F.example.com/' " +
6142
+ "even with a scheme hint of 'ftp'" do
6143
+ @uri = Addressable::URI.heuristic_parse(@input, {:scheme => 'ftp'})
6144
+ expect(@uri.to_s).to eq("http://prefix%2F.example.com/")
6145
+ end
6146
+ end
6147
+
5881
6148
  describe Addressable::URI, "when given the input " +
5882
6149
  "'/path/to/resource'" do
5883
6150
  before do
@@ -18,8 +18,9 @@ namespace :gem do
18
18
  exit(1)
19
19
  end
20
20
 
21
- s.required_ruby_version = '>= 1.9.0'
21
+ s.required_ruby_version = '>= 2.0'
22
22
 
23
+ s.add_runtime_dependency 'public_suffix', '~> 2.0', '>= 2.0.2'
23
24
  s.add_development_dependency 'bundler', '~> 1.0'
24
25
 
25
26
  s.require_path = "lib"
@@ -39,15 +40,8 @@ namespace :gem do
39
40
  desc "Generates .gemspec file"
40
41
  task :gemspec do
41
42
  spec_string = GEM_SPEC.to_ruby
42
-
43
- begin
44
- Thread.new { eval("$SAFE = 3\n#{spec_string}", binding) }.join
45
- rescue
46
- abort "unsafe gemspec: #{$!}"
47
- else
48
- File.open("#{GEM_SPEC.name}.gemspec", 'w') do |file|
49
- file.write spec_string
50
- end
43
+ File.open("#{GEM_SPEC.name}.gemspec", 'w') do |file|
44
+ file.write spec_string
51
45
  end
52
46
  end
53
47
 
metadata CHANGED
@@ -1,15 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: addressable
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Aman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-07 00:00:00.000000000 Z
11
+ date: 2016-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: public_suffix
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 2.0.2
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '2.0'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 2.0.2
13
33
  - !ruby/object:Gem::Dependency
14
34
  name: bundler
15
35
  requirement: !ruby/object:Gem::Requirement
@@ -39,7 +59,6 @@ files:
39
59
  - LICENSE.txt
40
60
  - README.md
41
61
  - Rakefile
42
- - addressable.gemspec
43
62
  - data/unicode.data
44
63
  - lib/addressable.rb
45
64
  - lib/addressable/idna.rb
@@ -75,7 +94,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
75
94
  requirements:
76
95
  - - ">="
77
96
  - !ruby/object:Gem::Version
78
- version: 1.9.0
97
+ version: '2.0'
79
98
  required_rubygems_version: !ruby/object:Gem::Requirement
80
99
  requirements:
81
100
  - - ">="
@@ -83,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
102
  version: '0'
84
103
  requirements: []
85
104
  rubyforge_project:
86
- rubygems_version: 2.5.0
105
+ rubygems_version: 2.5.1
87
106
  signing_key:
88
107
  specification_version: 4
89
108
  summary: URI Implementation
@@ -1,34 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- # stub: addressable 2.4.0 ruby lib
3
-
4
- Gem::Specification.new do |s|
5
- s.name = "addressable"
6
- s.version = "2.4.0"
7
-
8
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
- s.require_paths = ["lib"]
10
- s.authors = ["Bob Aman"]
11
- s.date = "2015-12-07"
12
- s.description = "Addressable is a replacement for the URI implementation that is part of\nRuby's standard library. It more closely conforms to the relevant RFCs and\nadds support for IRIs and URI templates.\n"
13
- s.email = "bob@sporkmonger.com"
14
- s.extra_rdoc_files = ["README.md"]
15
- s.files = ["CHANGELOG.md", "Gemfile", "LICENSE.txt", "README.md", "Rakefile", "addressable.gemspec", "data/unicode.data", "lib/addressable.rb", "lib/addressable/idna.rb", "lib/addressable/idna/native.rb", "lib/addressable/idna/pure.rb", "lib/addressable/template.rb", "lib/addressable/uri.rb", "lib/addressable/version.rb", "spec/addressable/idna_spec.rb", "spec/addressable/net_http_compat_spec.rb", "spec/addressable/rack_mount_compat_spec.rb", "spec/addressable/security_spec.rb", "spec/addressable/template_spec.rb", "spec/addressable/uri_spec.rb", "spec/spec_helper.rb", "tasks/clobber.rake", "tasks/gem.rake", "tasks/git.rake", "tasks/metrics.rake", "tasks/rspec.rake", "tasks/yard.rake"]
16
- s.homepage = "https://github.com/sporkmonger/addressable"
17
- s.licenses = ["Apache-2.0"]
18
- s.rdoc_options = ["--main", "README.md"]
19
- s.required_ruby_version = Gem::Requirement.new(">= 1.9.0")
20
- s.rubygems_version = "2.5.0"
21
- s.summary = "URI Implementation"
22
-
23
- if s.respond_to? :specification_version then
24
- s.specification_version = 4
25
-
26
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
27
- s.add_development_dependency(%q<bundler>, ["~> 1.0"])
28
- else
29
- s.add_dependency(%q<bundler>, ["~> 1.0"])
30
- end
31
- else
32
- s.add_dependency(%q<bundler>, ["~> 1.0"])
33
- end
34
- end