addressable 2.8.8 → 2.8.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -1
- data/lib/addressable/idna/pure.rb +0 -10
- data/lib/addressable/version.rb +1 -1
- metadata +3 -39
- data/Gemfile +0 -31
- data/Rakefile +0 -37
- data/addressable.gemspec +0 -28
- data/spec/addressable/idna_spec.rb +0 -302
- data/spec/addressable/net_http_compat_spec.rb +0 -29
- data/spec/addressable/security_spec.rb +0 -58
- data/spec/addressable/template_spec.rb +0 -1264
- data/spec/addressable/uri_spec.rb +0 -6854
- data/spec/spec_helper.rb +0 -33
- data/tasks/clobber.rake +0 -4
- data/tasks/gem.rake +0 -100
- data/tasks/git.rake +0 -47
- data/tasks/metrics.rake +0 -24
- data/tasks/profile.rake +0 -72
- data/tasks/rspec.rake +0 -23
- data/tasks/yard.rake +0 -29
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d530bb874824f8d1004aaea0fb9cd6721e0bd791c404fcb1a15f79f821f056b1
|
|
4
|
+
data.tar.gz: a9f4955da072c19e998744fedd8dd12129027caae3f4854108054358ee0b740f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 216c9bf5530cd1265b9418864d0ab4222ce7040c5cbb5501e6185ad44058970423f025291511cbabad3e20115dab935476af53c4e4aeffd79a7e3423f6770045
|
|
7
|
+
data.tar.gz: 2c5ddcfa6e8e51bef14738173066debd7a54b920f68568e689d49bb0111ac0320d660440db8011912cd943f895ea0a4f62e387ac4699bde736c74db779c35845
|
data/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Addressable 2.8.9 <a name="v2.8.9">
|
|
4
|
+
- Reduce gem size by excluding test files ([#569])
|
|
5
|
+
- No need for bundler as development dependency ([#571], [5fc1d93](https://github.com/sporkmonger/addressable/commit/5fc1d93))
|
|
6
|
+
- idna/pure: stop building the useless `COMPOSITION_TABLE` (removes the `Addressable::IDNA::COMPOSITION_TABLE` constant) ([#564])
|
|
7
|
+
|
|
8
|
+
[#569]: https://github.com/sporkmonger/addressable/pull/569
|
|
9
|
+
[#571]: https://github.com/sporkmonger/addressable/pull/571
|
|
10
|
+
[#564]: https://github.com/sporkmonger/addressable/pull/564
|
|
11
|
+
|
|
3
12
|
## Addressable 2.8.8 <a name="v2.8.8">
|
|
4
13
|
- Replace the `unicode.data` blob by a ruby constant ([#561])
|
|
5
14
|
- Allow `public_suffix` 7 ([#558])
|
|
6
15
|
|
|
7
16
|
[#561]: https://github.com/sporkmonger/addressable/pull/561
|
|
8
|
-
[#
|
|
17
|
+
[#558]: https://github.com/sporkmonger/addressable/pull/558
|
|
9
18
|
|
|
10
19
|
## Addressable 2.8.7 <a name="v2.8.7">
|
|
11
20
|
- Allow `public_suffix` 6 ([#535])
|
|
@@ -4384,16 +4384,6 @@ module Addressable
|
|
|
4384
4384
|
65518 => [0, 0, nil, "○", nil, nil, nil],
|
|
4385
4385
|
}
|
|
4386
4386
|
|
|
4387
|
-
COMPOSITION_TABLE = {}
|
|
4388
|
-
UNICODE_DATA.each do |codepoint, data|
|
|
4389
|
-
canonical = data[UNICODE_DATA_CANONICAL]
|
|
4390
|
-
exclusion = data[UNICODE_DATA_EXCLUSION]
|
|
4391
|
-
|
|
4392
|
-
if canonical && exclusion == 0
|
|
4393
|
-
COMPOSITION_TABLE[canonical.unpack("C*")] = codepoint
|
|
4394
|
-
end
|
|
4395
|
-
end
|
|
4396
|
-
|
|
4397
4387
|
UNICODE_MAX_LENGTH = 256
|
|
4398
4388
|
ACE_MAX_LENGTH = 256
|
|
4399
4389
|
|
data/lib/addressable/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: addressable
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.8.
|
|
4
|
+
version: 2.8.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bob Aman
|
|
@@ -29,26 +29,6 @@ dependencies:
|
|
|
29
29
|
- - "<"
|
|
30
30
|
- !ruby/object:Gem::Version
|
|
31
31
|
version: '8.0'
|
|
32
|
-
- !ruby/object:Gem::Dependency
|
|
33
|
-
name: bundler
|
|
34
|
-
requirement: !ruby/object:Gem::Requirement
|
|
35
|
-
requirements:
|
|
36
|
-
- - ">="
|
|
37
|
-
- !ruby/object:Gem::Version
|
|
38
|
-
version: '1.0'
|
|
39
|
-
- - "<"
|
|
40
|
-
- !ruby/object:Gem::Version
|
|
41
|
-
version: '3.0'
|
|
42
|
-
type: :development
|
|
43
|
-
prerelease: false
|
|
44
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
45
|
-
requirements:
|
|
46
|
-
- - ">="
|
|
47
|
-
- !ruby/object:Gem::Version
|
|
48
|
-
version: '1.0'
|
|
49
|
-
- - "<"
|
|
50
|
-
- !ruby/object:Gem::Version
|
|
51
|
-
version: '3.0'
|
|
52
32
|
description: |
|
|
53
33
|
Addressable is an alternative implementation to the URI implementation that is
|
|
54
34
|
part of Ruby's standard library. It is flexible, offers heuristic parsing, and
|
|
@@ -60,11 +40,8 @@ extra_rdoc_files:
|
|
|
60
40
|
- README.md
|
|
61
41
|
files:
|
|
62
42
|
- CHANGELOG.md
|
|
63
|
-
- Gemfile
|
|
64
43
|
- LICENSE.txt
|
|
65
44
|
- README.md
|
|
66
|
-
- Rakefile
|
|
67
|
-
- addressable.gemspec
|
|
68
45
|
- lib/addressable.rb
|
|
69
46
|
- lib/addressable/idna.rb
|
|
70
47
|
- lib/addressable/idna/native.rb
|
|
@@ -72,24 +49,11 @@ files:
|
|
|
72
49
|
- lib/addressable/template.rb
|
|
73
50
|
- lib/addressable/uri.rb
|
|
74
51
|
- lib/addressable/version.rb
|
|
75
|
-
- spec/addressable/idna_spec.rb
|
|
76
|
-
- spec/addressable/net_http_compat_spec.rb
|
|
77
|
-
- spec/addressable/security_spec.rb
|
|
78
|
-
- spec/addressable/template_spec.rb
|
|
79
|
-
- spec/addressable/uri_spec.rb
|
|
80
|
-
- spec/spec_helper.rb
|
|
81
|
-
- tasks/clobber.rake
|
|
82
|
-
- tasks/gem.rake
|
|
83
|
-
- tasks/git.rake
|
|
84
|
-
- tasks/metrics.rake
|
|
85
|
-
- tasks/profile.rake
|
|
86
|
-
- tasks/rspec.rake
|
|
87
|
-
- tasks/yard.rake
|
|
88
52
|
homepage: https://github.com/sporkmonger/addressable
|
|
89
53
|
licenses:
|
|
90
54
|
- Apache-2.0
|
|
91
55
|
metadata:
|
|
92
|
-
changelog_uri: https://github.com/sporkmonger/addressable/blob/main/CHANGELOG.md#v2.8.
|
|
56
|
+
changelog_uri: https://github.com/sporkmonger/addressable/blob/main/CHANGELOG.md#v2.8.9
|
|
93
57
|
rdoc_options:
|
|
94
58
|
- "--main"
|
|
95
59
|
- README.md
|
|
@@ -106,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
106
70
|
- !ruby/object:Gem::Version
|
|
107
71
|
version: '0'
|
|
108
72
|
requirements: []
|
|
109
|
-
rubygems_version:
|
|
73
|
+
rubygems_version: 4.0.3
|
|
110
74
|
specification_version: 4
|
|
111
75
|
summary: URI Implementation
|
|
112
76
|
test_files: []
|
data/Gemfile
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
source 'https://rubygems.org'
|
|
4
|
-
|
|
5
|
-
gemspec
|
|
6
|
-
|
|
7
|
-
group :test do
|
|
8
|
-
gem 'bigdecimal' if RUBY_VERSION > '2.4'
|
|
9
|
-
gem 'rspec', '~> 3.8'
|
|
10
|
-
gem 'rspec-its', '~> 1.3'
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
group :coverage do
|
|
14
|
-
gem "coveralls", "> 0.7", require: false, platforms: :mri
|
|
15
|
-
gem "simplecov", require: false
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
group :development do
|
|
19
|
-
gem 'launchy', '~> 2.4', '>= 2.4.3'
|
|
20
|
-
gem 'redcarpet', :platform => :mri_19
|
|
21
|
-
gem 'yard'
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
group :test, :development do
|
|
25
|
-
gem 'memory_profiler'
|
|
26
|
-
gem "rake", ">= 12.3.3"
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
unless ENV["IDNA_MODE"] == "pure"
|
|
30
|
-
gem "idn-ruby", platform: :mri
|
|
31
|
-
end
|
data/Rakefile
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'rubygems'
|
|
4
|
-
require 'rake'
|
|
5
|
-
|
|
6
|
-
require File.join(File.dirname(__FILE__), 'lib', 'addressable', 'version')
|
|
7
|
-
|
|
8
|
-
PKG_DISPLAY_NAME = 'Addressable'
|
|
9
|
-
PKG_NAME = PKG_DISPLAY_NAME.downcase
|
|
10
|
-
PKG_VERSION = Addressable::VERSION::STRING
|
|
11
|
-
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
|
|
12
|
-
|
|
13
|
-
RELEASE_NAME = "REL #{PKG_VERSION}"
|
|
14
|
-
|
|
15
|
-
PKG_SUMMARY = "URI Implementation"
|
|
16
|
-
PKG_DESCRIPTION = <<-TEXT
|
|
17
|
-
Addressable is an alternative implementation to the URI implementation that is
|
|
18
|
-
part of Ruby's standard library. It is flexible, offers heuristic parsing, and
|
|
19
|
-
additionally provides extensive support for IRIs and URI templates.
|
|
20
|
-
TEXT
|
|
21
|
-
|
|
22
|
-
PKG_FILES = FileList[
|
|
23
|
-
"data/**/*",
|
|
24
|
-
"lib/**/*.rb",
|
|
25
|
-
"spec/**/*.rb",
|
|
26
|
-
"tasks/**/*.rake",
|
|
27
|
-
"addressable.gemspec",
|
|
28
|
-
"CHANGELOG.md",
|
|
29
|
-
"Gemfile",
|
|
30
|
-
"LICENSE.txt",
|
|
31
|
-
"README.md",
|
|
32
|
-
"Rakefile",
|
|
33
|
-
]
|
|
34
|
-
|
|
35
|
-
task :default => "spec"
|
|
36
|
-
|
|
37
|
-
Dir['tasks/**/*.rake'].each { |rake| load rake }
|
data/addressable.gemspec
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
|
2
|
-
# stub: addressable 2.8.8 ruby lib
|
|
3
|
-
|
|
4
|
-
Gem::Specification.new do |s|
|
|
5
|
-
s.name = "addressable".freeze
|
|
6
|
-
s.version = "2.8.8".freeze
|
|
7
|
-
|
|
8
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
|
9
|
-
s.metadata = { "changelog_uri" => "https://github.com/sporkmonger/addressable/blob/main/CHANGELOG.md#v2.8.8" } if s.respond_to? :metadata=
|
|
10
|
-
s.require_paths = ["lib".freeze]
|
|
11
|
-
s.authors = ["Bob Aman".freeze]
|
|
12
|
-
s.date = "2025-11-24"
|
|
13
|
-
s.description = "Addressable is an alternative implementation to the URI implementation that is\npart of Ruby's standard library. It is flexible, offers heuristic parsing, and\nadditionally provides extensive support for IRIs and URI templates.\n".freeze
|
|
14
|
-
s.email = "bob@sporkmonger.com".freeze
|
|
15
|
-
s.extra_rdoc_files = ["README.md".freeze]
|
|
16
|
-
s.files = ["CHANGELOG.md".freeze, "Gemfile".freeze, "LICENSE.txt".freeze, "README.md".freeze, "Rakefile".freeze, "addressable.gemspec".freeze, "data/unicode.data".freeze, "lib/addressable.rb".freeze, "lib/addressable/idna.rb".freeze, "lib/addressable/idna/native.rb".freeze, "lib/addressable/idna/pure.rb".freeze, "lib/addressable/template.rb".freeze, "lib/addressable/uri.rb".freeze, "lib/addressable/version.rb".freeze, "spec/addressable/idna_spec.rb".freeze, "spec/addressable/net_http_compat_spec.rb".freeze, "spec/addressable/security_spec.rb".freeze, "spec/addressable/template_spec.rb".freeze, "spec/addressable/uri_spec.rb".freeze, "spec/spec_helper.rb".freeze, "tasks/clobber.rake".freeze, "tasks/gem.rake".freeze, "tasks/git.rake".freeze, "tasks/metrics.rake".freeze, "tasks/profile.rake".freeze, "tasks/rspec.rake".freeze, "tasks/yard.rake".freeze]
|
|
17
|
-
s.homepage = "https://github.com/sporkmonger/addressable".freeze
|
|
18
|
-
s.licenses = ["Apache-2.0".freeze]
|
|
19
|
-
s.rdoc_options = ["--main".freeze, "README.md".freeze]
|
|
20
|
-
s.required_ruby_version = Gem::Requirement.new(">= 2.2".freeze)
|
|
21
|
-
s.rubygems_version = "3.7.2".freeze
|
|
22
|
-
s.summary = "URI Implementation".freeze
|
|
23
|
-
|
|
24
|
-
s.specification_version = 4
|
|
25
|
-
|
|
26
|
-
s.add_runtime_dependency(%q<public_suffix>.freeze, [">= 2.0.2".freeze, "< 8.0".freeze])
|
|
27
|
-
s.add_development_dependency(%q<bundler>.freeze, [">= 1.0".freeze, "< 3.0".freeze])
|
|
28
|
-
end
|
|
@@ -1,302 +0,0 @@
|
|
|
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
|
-
# Have to use RubyGems to load the idn gem.
|
|
21
|
-
require "rubygems"
|
|
22
|
-
|
|
23
|
-
require "addressable/idna"
|
|
24
|
-
|
|
25
|
-
shared_examples_for "converting from unicode to ASCII" do
|
|
26
|
-
it "should convert 'www.google.com' correctly" do
|
|
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)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
it "should convert 'www.詹姆斯.com' correctly" do
|
|
36
|
-
expect(Addressable::IDNA.to_ascii(
|
|
37
|
-
"www.詹姆斯.com"
|
|
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")
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
it "should convert 'www.Iñtërnâtiônàlizætiøn.com' correctly" do
|
|
48
|
-
"www.Iñtërnâtiônàlizætiøn.com"
|
|
49
|
-
expect(Addressable::IDNA.to_ascii(
|
|
50
|
-
"www.I\xC3\xB1t\xC3\xABrn\xC3\xA2ti\xC3\xB4" +
|
|
51
|
-
"n\xC3\xA0liz\xC3\xA6ti\xC3\xB8n.com"
|
|
52
|
-
)).to eq("www.xn--itrntinliztin-vdb0a5exd8ewcye.com")
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
it "should convert 'www.Iñtërnâtiônàlizætiøn.com' correctly" do
|
|
56
|
-
expect(Addressable::IDNA.to_ascii(
|
|
57
|
-
"www.In\xCC\x83te\xCC\x88rna\xCC\x82tio\xCC\x82n" +
|
|
58
|
-
"a\xCC\x80liz\xC3\xA6ti\xC3\xB8n.com"
|
|
59
|
-
)).to eq("www.xn--itrntinliztin-vdb0a5exd8ewcye.com")
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
it "should convert " +
|
|
63
|
-
"'www.ほんとうにながいわけのわからないどめいんめいのらべるまだながくしないとたりない.w3.mag.keio.ac.jp' " +
|
|
64
|
-
"correctly" do
|
|
65
|
-
expect(Addressable::IDNA.to_ascii(
|
|
66
|
-
"www.\343\201\273\343\202\223\343\201\250\343\201\206\343\201\253\343" +
|
|
67
|
-
"\201\252\343\201\214\343\201\204\343\202\217\343\201\221\343\201\256" +
|
|
68
|
-
"\343\202\217\343\201\213\343\202\211\343\201\252\343\201\204\343\201" +
|
|
69
|
-
"\251\343\202\201\343\201\204\343\202\223\343\202\201\343\201\204\343" +
|
|
70
|
-
"\201\256\343\202\211\343\201\271\343\202\213\343\201\276\343\201\240" +
|
|
71
|
-
"\343\201\252\343\201\214\343\201\217\343\201\227\343\201\252\343\201" +
|
|
72
|
-
"\204\343\201\250\343\201\237\343\202\212\343\201\252\343\201\204." +
|
|
73
|
-
"w3.mag.keio.ac.jp"
|
|
74
|
-
)).to eq(
|
|
75
|
-
"www.xn--n8jaaaaai5bhf7as8fsfk3jnknefdde3" +
|
|
76
|
-
"fg11amb5gzdb4wi9bya3kc6lra.w3.mag.keio.ac.jp"
|
|
77
|
-
)
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
it "should convert " +
|
|
81
|
-
"'www.ほんとうにながいわけのわからないどめいんめいのらべるまだながくしないとたりない.w3.mag.keio.ac.jp' " +
|
|
82
|
-
"correctly" do
|
|
83
|
-
expect(Addressable::IDNA.to_ascii(
|
|
84
|
-
"www.\343\201\273\343\202\223\343\201\250\343\201\206\343\201\253\343" +
|
|
85
|
-
"\201\252\343\201\213\343\202\231\343\201\204\343\202\217\343\201\221" +
|
|
86
|
-
"\343\201\256\343\202\217\343\201\213\343\202\211\343\201\252\343\201" +
|
|
87
|
-
"\204\343\201\250\343\202\231\343\202\201\343\201\204\343\202\223\343" +
|
|
88
|
-
"\202\201\343\201\204\343\201\256\343\202\211\343\201\270\343\202\231" +
|
|
89
|
-
"\343\202\213\343\201\276\343\201\237\343\202\231\343\201\252\343\201" +
|
|
90
|
-
"\213\343\202\231\343\201\217\343\201\227\343\201\252\343\201\204\343" +
|
|
91
|
-
"\201\250\343\201\237\343\202\212\343\201\252\343\201\204." +
|
|
92
|
-
"w3.mag.keio.ac.jp"
|
|
93
|
-
)).to eq(
|
|
94
|
-
"www.xn--n8jaaaaai5bhf7as8fsfk3jnknefdde3" +
|
|
95
|
-
"fg11amb5gzdb4wi9bya3kc6lra.w3.mag.keio.ac.jp"
|
|
96
|
-
)
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
it "should convert '点心和烤鸭.w3.mag.keio.ac.jp' correctly" do
|
|
100
|
-
expect(Addressable::IDNA.to_ascii(
|
|
101
|
-
"点心和烤鸭.w3.mag.keio.ac.jp"
|
|
102
|
-
)).to eq("xn--0trv4xfvn8el34t.w3.mag.keio.ac.jp")
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
it "should convert '가각갂갃간갅갆갇갈갉힢힣.com' correctly" do
|
|
106
|
-
expect(Addressable::IDNA.to_ascii(
|
|
107
|
-
"가각갂갃간갅갆갇갈갉힢힣.com"
|
|
108
|
-
)).to eq("xn--o39acdefghijk5883jma.com")
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
it "should convert " +
|
|
112
|
-
"'\347\242\274\346\250\231\346\272\226\350" +
|
|
113
|
-
"\220\254\345\234\213\347\242\274.com' correctly" do
|
|
114
|
-
expect(Addressable::IDNA.to_ascii(
|
|
115
|
-
"\347\242\274\346\250\231\346\272\226\350" +
|
|
116
|
-
"\220\254\345\234\213\347\242\274.com"
|
|
117
|
-
)).to eq("xn--9cs565brid46mda086o.com")
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
it "should convert 'リ宠퐱〹.com' correctly" do
|
|
121
|
-
expect(Addressable::IDNA.to_ascii(
|
|
122
|
-
"\357\276\230\345\256\240\355\220\261\343\200\271.com"
|
|
123
|
-
)).to eq("xn--eek174hoxfpr4k.com")
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
it "should convert 'リ宠퐱卄.com' correctly" do
|
|
127
|
-
expect(Addressable::IDNA.to_ascii(
|
|
128
|
-
"\343\203\252\345\256\240\355\220\261\345\215\204.com"
|
|
129
|
-
)).to eq("xn--eek174hoxfpr4k.com")
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
it "should convert 'ᆵ' correctly" do
|
|
133
|
-
expect(Addressable::IDNA.to_ascii(
|
|
134
|
-
"\341\206\265"
|
|
135
|
-
)).to eq("xn--4ud")
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
it "should convert 'ᆵ' correctly" do
|
|
139
|
-
expect(Addressable::IDNA.to_ascii(
|
|
140
|
-
"\357\276\257"
|
|
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")
|
|
154
|
-
end
|
|
155
|
-
end
|
|
156
|
-
|
|
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
|
-
|
|
172
|
-
it "should convert 'www.google.com' correctly" do
|
|
173
|
-
expect(Addressable::IDNA.to_unicode("www.google.com")).to eq(
|
|
174
|
-
"www.google.com")
|
|
175
|
-
end
|
|
176
|
-
|
|
177
|
-
it "should convert 'www.詹姆斯.com' correctly" do
|
|
178
|
-
expect(Addressable::IDNA.to_unicode(
|
|
179
|
-
"www.xn--8ws00zhy3a.com"
|
|
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")
|
|
187
|
-
end
|
|
188
|
-
|
|
189
|
-
it "should convert 'www.iñtërnâtiônàlizætiøn.com' correctly" do
|
|
190
|
-
expect(Addressable::IDNA.to_unicode(
|
|
191
|
-
"www.xn--itrntinliztin-vdb0a5exd8ewcye.com"
|
|
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")
|
|
199
|
-
end
|
|
200
|
-
|
|
201
|
-
it "should convert " +
|
|
202
|
-
"'www.ほんとうにながいわけのわからないどめいんめいのらべるまだながくしないとたりない.w3.mag.keio.ac.jp' " +
|
|
203
|
-
"correctly" do
|
|
204
|
-
expect(Addressable::IDNA.to_unicode(
|
|
205
|
-
"www.xn--n8jaaaaai5bhf7as8fsfk3jnknefdde3" +
|
|
206
|
-
"fg11amb5gzdb4wi9bya3kc6lra.w3.mag.keio.ac.jp"
|
|
207
|
-
)).to eq(
|
|
208
|
-
"www.ほんとうにながいわけのわからないどめいんめいのらべるまだながくしないとたりない.w3.mag.keio.ac.jp"
|
|
209
|
-
)
|
|
210
|
-
end
|
|
211
|
-
|
|
212
|
-
it "should convert '点心和烤鸭.w3.mag.keio.ac.jp' correctly" do
|
|
213
|
-
expect(Addressable::IDNA.to_unicode(
|
|
214
|
-
"xn--0trv4xfvn8el34t.w3.mag.keio.ac.jp"
|
|
215
|
-
)).to eq("点心和烤鸭.w3.mag.keio.ac.jp")
|
|
216
|
-
end
|
|
217
|
-
|
|
218
|
-
it "should convert '가각갂갃간갅갆갇갈갉힢힣.com' correctly" do
|
|
219
|
-
expect(Addressable::IDNA.to_unicode(
|
|
220
|
-
"xn--o39acdefghijk5883jma.com"
|
|
221
|
-
)).to eq("가각갂갃간갅갆갇갈갉힢힣.com")
|
|
222
|
-
end
|
|
223
|
-
|
|
224
|
-
it "should convert " +
|
|
225
|
-
"'\347\242\274\346\250\231\346\272\226\350" +
|
|
226
|
-
"\220\254\345\234\213\347\242\274.com' correctly" do
|
|
227
|
-
expect(Addressable::IDNA.to_unicode(
|
|
228
|
-
"xn--9cs565brid46mda086o.com"
|
|
229
|
-
)).to eq(
|
|
230
|
-
"\347\242\274\346\250\231\346\272\226\350" +
|
|
231
|
-
"\220\254\345\234\213\347\242\274.com"
|
|
232
|
-
)
|
|
233
|
-
end
|
|
234
|
-
|
|
235
|
-
it "should convert 'リ宠퐱卄.com' correctly" do
|
|
236
|
-
expect(Addressable::IDNA.to_unicode(
|
|
237
|
-
"xn--eek174hoxfpr4k.com"
|
|
238
|
-
)).to eq("\343\203\252\345\256\240\355\220\261\345\215\204.com")
|
|
239
|
-
end
|
|
240
|
-
|
|
241
|
-
it "should convert 'ᆵ' correctly" do
|
|
242
|
-
expect(Addressable::IDNA.to_unicode(
|
|
243
|
-
"xn--4ud"
|
|
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")
|
|
257
|
-
end
|
|
258
|
-
end
|
|
259
|
-
|
|
260
|
-
describe Addressable::IDNA, "when using the pure-Ruby implementation" do
|
|
261
|
-
before do
|
|
262
|
-
Addressable.send(:remove_const, :IDNA)
|
|
263
|
-
load "addressable/idna/pure.rb"
|
|
264
|
-
end
|
|
265
|
-
|
|
266
|
-
it_should_behave_like "converting from unicode to ASCII"
|
|
267
|
-
it_should_behave_like "converting from ASCII to unicode"
|
|
268
|
-
|
|
269
|
-
begin
|
|
270
|
-
require "fiber"
|
|
271
|
-
|
|
272
|
-
it "should not blow up inside fibers" do
|
|
273
|
-
f = Fiber.new do
|
|
274
|
-
Addressable.send(:remove_const, :IDNA)
|
|
275
|
-
load "addressable/idna/pure.rb"
|
|
276
|
-
end
|
|
277
|
-
f.resume
|
|
278
|
-
end
|
|
279
|
-
rescue LoadError
|
|
280
|
-
# Fibers aren't supported in this version of Ruby, skip this test.
|
|
281
|
-
warn('Fibers unsupported.')
|
|
282
|
-
end
|
|
283
|
-
end
|
|
284
|
-
|
|
285
|
-
begin
|
|
286
|
-
require "idn"
|
|
287
|
-
|
|
288
|
-
describe Addressable::IDNA, "when using the native-code implementation" do
|
|
289
|
-
before do
|
|
290
|
-
Addressable.send(:remove_const, :IDNA)
|
|
291
|
-
load "addressable/idna/native.rb"
|
|
292
|
-
end
|
|
293
|
-
|
|
294
|
-
it_should_behave_like "converting from unicode to ASCII"
|
|
295
|
-
it_should_behave_like "converting from ASCII to unicode"
|
|
296
|
-
end
|
|
297
|
-
rescue LoadError => error
|
|
298
|
-
raise error if ENV["CI"] && TestHelper.native_supported?
|
|
299
|
-
|
|
300
|
-
# Cannot test the native implementation without libidn support.
|
|
301
|
-
warn('Could not load native IDN implementation.')
|
|
302
|
-
end
|
|
@@ -1,29 +0,0 @@
|
|
|
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
|
-
require "net/http"
|
|
22
|
-
|
|
23
|
-
describe Net::HTTP do
|
|
24
|
-
it "should be compatible with Addressable" do
|
|
25
|
-
response_body =
|
|
26
|
-
Net::HTTP.get(Addressable::URI.parse('http://www.google.com/'))
|
|
27
|
-
expect(response_body).not_to be_nil
|
|
28
|
-
end
|
|
29
|
-
end
|
|
@@ -1,58 +0,0 @@
|
|
|
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
|