addressable 2.5.1 → 2.5.2

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: 5bb436e09e69b39c2e10c2c3fe82c46519594528
4
- data.tar.gz: 4aa7bdf211117af5bff34ab09b21e5104df60732
3
+ metadata.gz: 609a17c9f46ce684482d241232f11a9b9fc81c81
4
+ data.tar.gz: 5d2febfcf1ecfc3deafe09afb18f8d423a917597
5
5
  SHA512:
6
- metadata.gz: 5b8404eb6f4d960d9d0973a45b2ef493d34f0ea2737b1c54fe3b1cc5035d74ba63f34ff155016fb4ff20111a5d605a19594c9a82a68085c2933dac9de3298c20
7
- data.tar.gz: 0c1b0b8aaf248ddfd6d7196e16d00101f9570ef2efad31a4c7649cc813b48ab07b8050b8b3aa1b0fe3c0709c69652b5317dbcc9ba51d94c72eb55fd6b533e8db
6
+ metadata.gz: c2643f4006865f0d7654ed88b925bd46a75fc3fc3eaf46dea2b7a57f72ffe7c2b90560bae9ce06ecca4d4a528db4fb8a28e24fdd882bc5d602177d2099ec1b6f
7
+ data.tar.gz: 2dcaa8fad9dfe031485391dec12e42bd9a45e105a1486c8e1ba9faeaa6f3600f9742b43e557776bfec9424c16e0dd0a1e22bc219da0e8c80559bfcf04ac405d8
@@ -1,3 +1,9 @@
1
+ # Addressable 2.5.2
2
+ - better support for frozen string literals
3
+ - fixed bug w/ uppercase characters in scheme
4
+ - IDNA errors w/ emoji URLs
5
+ - compatibility w/ public_suffix 3.x
6
+
1
7
  # Addressable 2.5.1
2
8
  - allow unicode normalization to be disabled for URI Template expansion
3
9
  - removed duplicate test
data/Gemfile CHANGED
@@ -29,4 +29,4 @@ group :test, :development do
29
29
  end
30
30
  end
31
31
 
32
- gem 'idn-ruby', :platform => [:mri_20, :mri_21, :mri_22]
32
+ gem 'idn-ruby', :platform => [:mri_20, :mri_21, :mri_22, :mri_23, :mri_24]
@@ -35,7 +35,7 @@ module Addressable
35
35
  def self.to_ascii(value)
36
36
  value.to_s.split('.', -1).map do |segment|
37
37
  if segment.size > 0 && segment.size < 64
38
- IDN::Idna.toASCII(segment)
38
+ IDN::Idna.toASCII(segment, IDN::Idna::ALLOW_UNASSIGNED)
39
39
  elsif segment.size >= 64
40
40
  segment
41
41
  else
@@ -47,7 +47,7 @@ module Addressable
47
47
  def self.to_unicode(value)
48
48
  value.to_s.split('.', -1).map do |segment|
49
49
  if segment.size > 0 && segment.size < 64
50
- IDN::Idna.toUnicode(segment)
50
+ IDN::Idna.toUnicode(segment, IDN::Idna::ALLOW_UNASSIGNED)
51
51
  elsif segment.size >= 64
52
52
  segment
53
53
  else
@@ -743,7 +743,7 @@ module Addressable
743
743
 
744
744
  vars
745
745
  .zip(operator_sequence(operator).take(vars.length))
746
- .reduce("") do |acc, (varspec, op)|
746
+ .reduce("".dup) do |acc, (varspec, op)|
747
747
  _, name, _ = *varspec.match(VARSPEC)
748
748
 
749
749
  acc << if mapping.key? name
@@ -436,7 +436,7 @@ module Addressable
436
436
  uri = uri.dup
437
437
  # Seriously, only use UTF-8. I'm really not kidding!
438
438
  uri.force_encoding("utf-8")
439
- leave_encoded.force_encoding("utf-8")
439
+ leave_encoded = leave_encoded.dup.force_encoding("utf-8")
440
440
  result = uri.gsub(/%[0-9a-f]{2}/iu) do |sequence|
441
441
  c = sequence[1..3].to_i(16).chr
442
442
  c.force_encoding("utf-8")
@@ -847,7 +847,7 @@ module Addressable
847
847
  return nil unless self.scheme
848
848
  @normalized_scheme ||= begin
849
849
  if self.scheme =~ /^\s*ssh\+svn\s*$/i
850
- "svn+ssh"
850
+ "svn+ssh".dup
851
851
  else
852
852
  Addressable::URI.normalize_component(
853
853
  self.scheme.strip.downcase,
@@ -1032,9 +1032,9 @@ module Addressable
1032
1032
  if !current_user && !current_password
1033
1033
  nil
1034
1034
  elsif current_user && current_password
1035
- "#{current_user}:#{current_password}"
1035
+ "#{current_user}:#{current_password}".dup
1036
1036
  elsif current_user && !current_password
1037
- "#{current_user}"
1037
+ "#{current_user}".dup
1038
1038
  end
1039
1039
  end
1040
1040
  # All normalized values should be UTF-8
@@ -1101,7 +1101,7 @@ module Addressable
1101
1101
  CharacterClasses::HOST)
1102
1102
  result
1103
1103
  else
1104
- EMPTY_STR
1104
+ EMPTY_STR.dup
1105
1105
  end
1106
1106
  end
1107
1107
  # All normalized values should be UTF-8
@@ -1421,7 +1421,7 @@ module Addressable
1421
1421
  # @return [String] The components that identify a site.
1422
1422
  def site
1423
1423
  (self.scheme || self.authority) && @site ||= begin
1424
- site_string = ""
1424
+ site_string = "".dup
1425
1425
  site_string << "#{self.scheme}:" if self.scheme != nil
1426
1426
  site_string << "//#{self.authority}" if self.authority != nil
1427
1427
  site_string
@@ -1440,7 +1440,7 @@ module Addressable
1440
1440
  def normalized_site
1441
1441
  return nil unless self.site
1442
1442
  @normalized_site ||= begin
1443
- site_string = ""
1443
+ site_string = "".dup
1444
1444
  if self.normalized_scheme != nil
1445
1445
  site_string << "#{self.normalized_scheme}:"
1446
1446
  end
@@ -1508,7 +1508,7 @@ module Addressable
1508
1508
  result = URI.normalize_path(result)
1509
1509
  if result.empty? &&
1510
1510
  ["http", "https", "ftp", "tftp"].include?(self.normalized_scheme)
1511
- result = SLASH
1511
+ result = SLASH.dup
1512
1512
  end
1513
1513
  result
1514
1514
  end
@@ -1694,7 +1694,7 @@ module Addressable
1694
1694
  end
1695
1695
 
1696
1696
  # new_query_values have form [['key1', 'value1'], ['key2', 'value2']]
1697
- buffer = ""
1697
+ buffer = "".dup
1698
1698
  new_query_values.each do |key, value|
1699
1699
  encoded_key = URI.encode_component(
1700
1700
  key, CharacterClasses::UNRESERVED
@@ -1724,7 +1724,7 @@ module Addressable
1724
1724
  #
1725
1725
  # @return [String] The request URI required for an HTTP request.
1726
1726
  def request_uri
1727
- return nil if self.absolute? && self.scheme !~ /^https?$/
1727
+ return nil if self.absolute? && self.scheme !~ /^https?$/i
1728
1728
  return (
1729
1729
  (!self.path.empty? ? self.path : SLASH) +
1730
1730
  (self.query ? "?#{self.query}" : EMPTY_STR)
@@ -1739,7 +1739,7 @@ module Addressable
1739
1739
  if !new_request_uri.respond_to?(:to_str)
1740
1740
  raise TypeError, "Can't convert #{new_request_uri.class} into String."
1741
1741
  end
1742
- if self.absolute? && self.scheme !~ /^https?$/
1742
+ if self.absolute? && self.scheme !~ /^https?$/i
1743
1743
  raise InvalidURIError,
1744
1744
  "Cannot set an HTTP request URI for a non-HTTP URI."
1745
1745
  end
@@ -22,7 +22,7 @@ if !defined?(Addressable::VERSION)
22
22
  module VERSION
23
23
  MAJOR = 2
24
24
  MINOR = 5
25
- TINY = 1
25
+ TINY = 2
26
26
 
27
27
  STRING = [MAJOR, MINOR, TINY].join('.')
28
28
  end
@@ -134,6 +134,12 @@ shared_examples_for "converting from unicode to ASCII" do
134
134
  )).to eq("xn--4ud")
135
135
  end
136
136
 
137
+ it "should convert '🌹🌹🌹.ws' correctly" do
138
+ expect(Addressable::IDNA.to_ascii(
139
+ "\360\237\214\271\360\237\214\271\360\237\214\271.ws"
140
+ )).to eq("xn--2h8haa.ws")
141
+ end
142
+
137
143
  it "should handle two adjacent '.'s correctly" do
138
144
  expect(Addressable::IDNA.to_ascii(
139
145
  "example..host"
@@ -231,6 +237,12 @@ shared_examples_for "converting from ASCII to unicode" do
231
237
  )).to eq("\341\206\265")
232
238
  end
233
239
 
240
+ it "should convert '🌹🌹🌹.ws' correctly" do
241
+ expect(Addressable::IDNA.to_unicode(
242
+ "xn--2h8haa.ws"
243
+ )).to eq("\360\237\214\271\360\237\214\271\360\237\214\271.ws")
244
+ end
245
+
234
246
  it "should handle two adjacent '.'s correctly" do
235
247
  expect(Addressable::IDNA.to_unicode(
236
248
  "example..host"
@@ -955,6 +955,10 @@ describe Addressable::URI, "when frozen" do
955
955
  expect(@uri.normalize.query).to eq("a=1")
956
956
  end
957
957
 
958
+ it "returns '/%70a%74%68?a=%31' for #request_uri" do
959
+ expect(@uri.request_uri).to eq("/%70a%74%68?a=%31")
960
+ end
961
+
958
962
  it "returns '1%323' for #fragment" do
959
963
  expect(@uri.fragment).to eq("1%323")
960
964
  end
@@ -1971,9 +1975,9 @@ end
1971
1975
 
1972
1976
  # Section 5.1.2 of RFC 2616
1973
1977
  describe Addressable::URI, "when parsed from " +
1974
- "'http://www.w3.org/pub/WWW/TheProject.html'" do
1978
+ "'HTTP://www.w3.org/pub/WWW/TheProject.html'" do
1975
1979
  before do
1976
- @uri = Addressable::URI.parse("http://www.w3.org/pub/WWW/TheProject.html")
1980
+ @uri = Addressable::URI.parse("HTTP://www.w3.org/pub/WWW/TheProject.html")
1977
1981
  end
1978
1982
 
1979
1983
  it "should have the correct request URI" do
@@ -2008,7 +2012,7 @@ describe Addressable::URI, "when parsed from " +
2008
2012
 
2009
2013
  it "should correctly convert to a hash" do
2010
2014
  expect(@uri.to_hash).to eq({
2011
- :scheme => "http",
2015
+ :scheme => "HTTP",
2012
2016
  :user => nil,
2013
2017
  :password => nil,
2014
2018
  :host => "www.w3.org",
@@ -20,7 +20,7 @@ namespace :gem do
20
20
 
21
21
  s.required_ruby_version = '>= 2.0'
22
22
 
23
- s.add_runtime_dependency 'public_suffix', '~> 2.0', '>= 2.0.2'
23
+ s.add_runtime_dependency 'public_suffix', '>= 2.0.2', '< 4.0'
24
24
  s.add_development_dependency 'bundler', '~> 1.0'
25
25
 
26
26
  s.require_path = "lib"
metadata CHANGED
@@ -1,35 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: addressable
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.1
4
+ version: 2.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Aman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-29 00:00:00.000000000 Z
11
+ date: 2017-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: public_suffix
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '2.0'
20
17
  - - ">="
21
18
  - !ruby/object:Gem::Version
22
19
  version: 2.0.2
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '4.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '2.0'
30
27
  - - ">="
31
28
  - !ruby/object:Gem::Version
32
29
  version: 2.0.2
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '4.0'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: bundler
35
35
  requirement: !ruby/object:Gem::Requirement