addressable 2.8.7 → 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 +64 -46
- data/README.md +6 -6
- data/lib/addressable/idna/pure.rb +4235 -30
- data/lib/addressable/uri.rb +1 -1
- data/lib/addressable/version.rb +1 -1
- metadata +6 -46
- data/Gemfile +0 -31
- data/Rakefile +0 -37
- data/addressable.gemspec +0 -28
- data/data/unicode.data +0 -0
- 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 -6840
- data/spec/spec_helper.rb +0 -33
- data/tasks/clobber.rake +0 -4
- data/tasks/gem.rake +0 -95
- 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
data/lib/addressable/uri.rb
CHANGED
|
@@ -2382,7 +2382,7 @@ module Addressable
|
|
|
2382
2382
|
#
|
|
2383
2383
|
# @return [String] The URI object's state, as a <code>String</code>.
|
|
2384
2384
|
def inspect
|
|
2385
|
-
sprintf("#<%s:%#0x URI:%s>",
|
|
2385
|
+
sprintf("#<%s:%#0x URI:%s>", self.class.to_s, self.object_id, self.to_s)
|
|
2386
2386
|
end
|
|
2387
2387
|
|
|
2388
2388
|
##
|
data/lib/addressable/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
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
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: public_suffix
|
|
@@ -19,7 +18,7 @@ dependencies:
|
|
|
19
18
|
version: 2.0.2
|
|
20
19
|
- - "<"
|
|
21
20
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: '
|
|
21
|
+
version: '8.0'
|
|
23
22
|
type: :runtime
|
|
24
23
|
prerelease: false
|
|
25
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -29,27 +28,7 @@ dependencies:
|
|
|
29
28
|
version: 2.0.2
|
|
30
29
|
- - "<"
|
|
31
30
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '
|
|
33
|
-
- !ruby/object:Gem::Dependency
|
|
34
|
-
name: bundler
|
|
35
|
-
requirement: !ruby/object:Gem::Requirement
|
|
36
|
-
requirements:
|
|
37
|
-
- - ">="
|
|
38
|
-
- !ruby/object:Gem::Version
|
|
39
|
-
version: '1.0'
|
|
40
|
-
- - "<"
|
|
41
|
-
- !ruby/object:Gem::Version
|
|
42
|
-
version: '3.0'
|
|
43
|
-
type: :development
|
|
44
|
-
prerelease: false
|
|
45
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
46
|
-
requirements:
|
|
47
|
-
- - ">="
|
|
48
|
-
- !ruby/object:Gem::Version
|
|
49
|
-
version: '1.0'
|
|
50
|
-
- - "<"
|
|
51
|
-
- !ruby/object:Gem::Version
|
|
52
|
-
version: '3.0'
|
|
31
|
+
version: '8.0'
|
|
53
32
|
description: |
|
|
54
33
|
Addressable is an alternative implementation to the URI implementation that is
|
|
55
34
|
part of Ruby's standard library. It is flexible, offers heuristic parsing, and
|
|
@@ -61,12 +40,8 @@ extra_rdoc_files:
|
|
|
61
40
|
- README.md
|
|
62
41
|
files:
|
|
63
42
|
- CHANGELOG.md
|
|
64
|
-
- Gemfile
|
|
65
43
|
- LICENSE.txt
|
|
66
44
|
- README.md
|
|
67
|
-
- Rakefile
|
|
68
|
-
- addressable.gemspec
|
|
69
|
-
- data/unicode.data
|
|
70
45
|
- lib/addressable.rb
|
|
71
46
|
- lib/addressable/idna.rb
|
|
72
47
|
- lib/addressable/idna/native.rb
|
|
@@ -74,25 +49,11 @@ files:
|
|
|
74
49
|
- lib/addressable/template.rb
|
|
75
50
|
- lib/addressable/uri.rb
|
|
76
51
|
- lib/addressable/version.rb
|
|
77
|
-
- spec/addressable/idna_spec.rb
|
|
78
|
-
- spec/addressable/net_http_compat_spec.rb
|
|
79
|
-
- spec/addressable/security_spec.rb
|
|
80
|
-
- spec/addressable/template_spec.rb
|
|
81
|
-
- spec/addressable/uri_spec.rb
|
|
82
|
-
- spec/spec_helper.rb
|
|
83
|
-
- tasks/clobber.rake
|
|
84
|
-
- tasks/gem.rake
|
|
85
|
-
- tasks/git.rake
|
|
86
|
-
- tasks/metrics.rake
|
|
87
|
-
- tasks/profile.rake
|
|
88
|
-
- tasks/rspec.rake
|
|
89
|
-
- tasks/yard.rake
|
|
90
52
|
homepage: https://github.com/sporkmonger/addressable
|
|
91
53
|
licenses:
|
|
92
54
|
- Apache-2.0
|
|
93
55
|
metadata:
|
|
94
|
-
changelog_uri: https://github.com/sporkmonger/addressable/blob/main/CHANGELOG.md#v2.8.
|
|
95
|
-
post_install_message:
|
|
56
|
+
changelog_uri: https://github.com/sporkmonger/addressable/blob/main/CHANGELOG.md#v2.8.9
|
|
96
57
|
rdoc_options:
|
|
97
58
|
- "--main"
|
|
98
59
|
- README.md
|
|
@@ -109,8 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
109
70
|
- !ruby/object:Gem::Version
|
|
110
71
|
version: '0'
|
|
111
72
|
requirements: []
|
|
112
|
-
rubygems_version:
|
|
113
|
-
signing_key:
|
|
73
|
+
rubygems_version: 4.0.3
|
|
114
74
|
specification_version: 4
|
|
115
75
|
summary: URI Implementation
|
|
116
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.7 ruby lib
|
|
3
|
-
|
|
4
|
-
Gem::Specification.new do |s|
|
|
5
|
-
s.name = "addressable".freeze
|
|
6
|
-
s.version = "2.8.7".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.7" } if s.respond_to? :metadata=
|
|
10
|
-
s.require_paths = ["lib".freeze]
|
|
11
|
-
s.authors = ["Bob Aman".freeze]
|
|
12
|
-
s.date = "2024-06-21"
|
|
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.5.11".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, "< 7.0".freeze])
|
|
27
|
-
s.add_development_dependency(%q<bundler>.freeze, [">= 1.0".freeze, "< 3.0".freeze])
|
|
28
|
-
end
|
data/data/unicode.data
DELETED
|
Binary file
|
|
@@ -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
|