addressable 2.3.3 → 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 +7 -0
- data/CHANGELOG.md +199 -29
- data/README.md +103 -69
- data/lib/addressable/idna/native.rb +31 -8
- data/lib/addressable/idna/pure.rb +4269 -217
- data/lib/addressable/idna.rb +3 -2
- data/lib/addressable/template.rb +243 -58
- data/lib/addressable/uri.rb +614 -294
- data/lib/addressable/version.rb +5 -4
- data/lib/addressable.rb +4 -0
- metadata +30 -81
- data/Gemfile +0 -18
- data/Rakefile +0 -37
- data/data/unicode.data +0 -0
- data/spec/addressable/idna_spec.rb +0 -231
- data/spec/addressable/net_http_compat_spec.rb +0 -26
- data/spec/addressable/template_spec.rb +0 -1022
- data/spec/addressable/uri_spec.rb +0 -5161
- data/tasks/clobber.rake +0 -2
- data/tasks/gem.rake +0 -86
- data/tasks/git.rake +0 -45
- data/tasks/metrics.rake +0 -22
- data/tasks/rspec.rake +0 -58
- data/tasks/rubyforge.rake +0 -89
- data/tasks/yard.rake +0 -27
- data/website/index.html +0 -110
data/lib/addressable/version.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
2
3
|
#--
|
|
3
|
-
# Copyright (C)
|
|
4
|
+
# Copyright (C) Bob Aman
|
|
4
5
|
#
|
|
5
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
7
|
# you may not use this file except in compliance with the License.
|
|
@@ -21,8 +22,8 @@ if !defined?(Addressable::VERSION)
|
|
|
21
22
|
module Addressable
|
|
22
23
|
module VERSION
|
|
23
24
|
MAJOR = 2
|
|
24
|
-
MINOR =
|
|
25
|
-
TINY =
|
|
25
|
+
MINOR = 8
|
|
26
|
+
TINY = 9
|
|
26
27
|
|
|
27
28
|
STRING = [MAJOR, MINOR, TINY].join('.')
|
|
28
29
|
end
|
data/lib/addressable.rb
ADDED
metadata
CHANGED
|
@@ -1,127 +1,76 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: addressable
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
5
|
-
prerelease:
|
|
4
|
+
version: 2.8.9
|
|
6
5
|
platform: ruby
|
|
7
6
|
authors:
|
|
8
7
|
- Bob Aman
|
|
9
|
-
autorequire:
|
|
10
8
|
bindir: bin
|
|
11
9
|
cert_chain: []
|
|
12
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
11
|
dependencies:
|
|
14
12
|
- !ruby/object:Gem::Dependency
|
|
15
|
-
name:
|
|
13
|
+
name: public_suffix
|
|
16
14
|
requirement: !ruby/object:Gem::Requirement
|
|
17
|
-
none: false
|
|
18
15
|
requirements:
|
|
19
|
-
- -
|
|
16
|
+
- - ">="
|
|
20
17
|
- !ruby/object:Gem::Version
|
|
21
|
-
version: 0.
|
|
22
|
-
|
|
23
|
-
prerelease: false
|
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
-
none: false
|
|
26
|
-
requirements:
|
|
27
|
-
- - ! '>='
|
|
18
|
+
version: 2.0.2
|
|
19
|
+
- - "<"
|
|
28
20
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: 0
|
|
30
|
-
|
|
31
|
-
name: rspec
|
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
|
33
|
-
none: false
|
|
34
|
-
requirements:
|
|
35
|
-
- - ! '>='
|
|
36
|
-
- !ruby/object:Gem::Version
|
|
37
|
-
version: 2.9.0
|
|
38
|
-
type: :development
|
|
21
|
+
version: '8.0'
|
|
22
|
+
type: :runtime
|
|
39
23
|
prerelease: false
|
|
40
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
-
none: false
|
|
42
25
|
requirements:
|
|
43
|
-
- -
|
|
26
|
+
- - ">="
|
|
44
27
|
- !ruby/object:Gem::Version
|
|
45
|
-
version: 2.
|
|
46
|
-
-
|
|
47
|
-
name: launchy
|
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
|
49
|
-
none: false
|
|
50
|
-
requirements:
|
|
51
|
-
- - ! '>='
|
|
28
|
+
version: 2.0.2
|
|
29
|
+
- - "<"
|
|
52
30
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: 0
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
requirements:
|
|
59
|
-
- - ! '>='
|
|
60
|
-
- !ruby/object:Gem::Version
|
|
61
|
-
version: 0.3.2
|
|
62
|
-
description: ! 'Addressable is a replacement for the URI implementation that is part
|
|
63
|
-
of
|
|
64
|
-
|
|
65
|
-
Ruby''s standard library. It more closely conforms to the relevant RFCs and
|
|
66
|
-
|
|
67
|
-
adds support for IRIs and URI templates.
|
|
68
|
-
|
|
69
|
-
'
|
|
31
|
+
version: '8.0'
|
|
32
|
+
description: |
|
|
33
|
+
Addressable is an alternative implementation to the URI implementation that is
|
|
34
|
+
part of Ruby's standard library. It is flexible, offers heuristic parsing, and
|
|
35
|
+
additionally provides extensive support for IRIs and URI templates.
|
|
70
36
|
email: bob@sporkmonger.com
|
|
71
37
|
executables: []
|
|
72
38
|
extensions: []
|
|
73
39
|
extra_rdoc_files:
|
|
74
40
|
- README.md
|
|
75
41
|
files:
|
|
42
|
+
- CHANGELOG.md
|
|
43
|
+
- LICENSE.txt
|
|
44
|
+
- README.md
|
|
45
|
+
- lib/addressable.rb
|
|
76
46
|
- lib/addressable/idna.rb
|
|
77
47
|
- lib/addressable/idna/native.rb
|
|
78
48
|
- lib/addressable/idna/pure.rb
|
|
79
49
|
- lib/addressable/template.rb
|
|
80
50
|
- lib/addressable/uri.rb
|
|
81
51
|
- lib/addressable/version.rb
|
|
82
|
-
|
|
83
|
-
- spec/addressable/net_http_compat_spec.rb
|
|
84
|
-
- spec/addressable/template_spec.rb
|
|
85
|
-
- spec/addressable/uri_spec.rb
|
|
86
|
-
- data/unicode.data
|
|
87
|
-
- tasks/clobber.rake
|
|
88
|
-
- tasks/gem.rake
|
|
89
|
-
- tasks/git.rake
|
|
90
|
-
- tasks/metrics.rake
|
|
91
|
-
- tasks/rspec.rake
|
|
92
|
-
- tasks/rubyforge.rake
|
|
93
|
-
- tasks/yard.rake
|
|
94
|
-
- website/index.html
|
|
95
|
-
- CHANGELOG.md
|
|
96
|
-
- Gemfile
|
|
97
|
-
- LICENSE.txt
|
|
98
|
-
- README.md
|
|
99
|
-
- Rakefile
|
|
100
|
-
homepage: http://addressable.rubyforge.org/
|
|
52
|
+
homepage: https://github.com/sporkmonger/addressable
|
|
101
53
|
licenses:
|
|
102
|
-
- Apache
|
|
103
|
-
|
|
54
|
+
- Apache-2.0
|
|
55
|
+
metadata:
|
|
56
|
+
changelog_uri: https://github.com/sporkmonger/addressable/blob/main/CHANGELOG.md#v2.8.9
|
|
104
57
|
rdoc_options:
|
|
105
|
-
- --main
|
|
58
|
+
- "--main"
|
|
106
59
|
- README.md
|
|
107
60
|
require_paths:
|
|
108
61
|
- lib
|
|
109
62
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
110
|
-
none: false
|
|
111
63
|
requirements:
|
|
112
|
-
- -
|
|
64
|
+
- - ">="
|
|
113
65
|
- !ruby/object:Gem::Version
|
|
114
|
-
version: '
|
|
66
|
+
version: '2.2'
|
|
115
67
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
|
-
none: false
|
|
117
68
|
requirements:
|
|
118
|
-
- -
|
|
69
|
+
- - ">="
|
|
119
70
|
- !ruby/object:Gem::Version
|
|
120
71
|
version: '0'
|
|
121
72
|
requirements: []
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
signing_key:
|
|
125
|
-
specification_version: 3
|
|
73
|
+
rubygems_version: 4.0.3
|
|
74
|
+
specification_version: 4
|
|
126
75
|
summary: URI Implementation
|
|
127
76
|
test_files: []
|
data/Gemfile
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
source 'https://rubygems.org'
|
|
2
|
-
|
|
3
|
-
group :development do
|
|
4
|
-
gem 'launchy'
|
|
5
|
-
gem 'yard'
|
|
6
|
-
gem 'redcarpet', :platform => :mri_19
|
|
7
|
-
gem 'rubyforge'
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
group :test, :development do
|
|
11
|
-
gem 'rake', '>= 0.7.3'
|
|
12
|
-
gem 'rspec', '>= 2.9.0'
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
gem 'idn', :platform => :mri_18
|
|
16
|
-
gem 'idn-ruby', :platform => :mri_19
|
|
17
|
-
|
|
18
|
-
gemspec
|
data/Rakefile
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
require 'rubygems'
|
|
2
|
-
require 'rake'
|
|
3
|
-
|
|
4
|
-
require File.join(File.dirname(__FILE__), 'lib', 'addressable', 'version')
|
|
5
|
-
|
|
6
|
-
PKG_DISPLAY_NAME = 'Addressable'
|
|
7
|
-
PKG_NAME = PKG_DISPLAY_NAME.downcase
|
|
8
|
-
PKG_VERSION = Addressable::VERSION::STRING
|
|
9
|
-
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
|
|
10
|
-
|
|
11
|
-
RELEASE_NAME = "REL #{PKG_VERSION}"
|
|
12
|
-
|
|
13
|
-
RUBY_FORGE_PROJECT = PKG_NAME
|
|
14
|
-
RUBY_FORGE_USER = "sporkmonger"
|
|
15
|
-
RUBY_FORGE_PATH = "/var/www/gforge-projects/#{RUBY_FORGE_PROJECT}"
|
|
16
|
-
RUBY_FORGE_URL = "http://#{RUBY_FORGE_PROJECT}.rubyforge.org/"
|
|
17
|
-
|
|
18
|
-
PKG_SUMMARY = "URI Implementation"
|
|
19
|
-
PKG_DESCRIPTION = <<-TEXT
|
|
20
|
-
Addressable is a replacement for the URI implementation that is part of
|
|
21
|
-
Ruby's standard library. It more closely conforms to the relevant RFCs and
|
|
22
|
-
adds support for IRIs and URI templates.
|
|
23
|
-
TEXT
|
|
24
|
-
|
|
25
|
-
PKG_FILES = FileList[
|
|
26
|
-
"lib/**/*", "spec/**/*", "vendor/**/*", "data/**/*",
|
|
27
|
-
"tasks/**/*", "website/**/*",
|
|
28
|
-
"[A-Z]*", "Rakefile"
|
|
29
|
-
].exclude(/database\.yml/).exclude(/Gemfile\.lock/).exclude(/[_\.]git$/)
|
|
30
|
-
|
|
31
|
-
RCOV_ENABLED = (RUBY_PLATFORM != "java" && RUBY_VERSION =~ /^1\.8/)
|
|
32
|
-
task :default => "spec"
|
|
33
|
-
|
|
34
|
-
WINDOWS = (RUBY_PLATFORM =~ /mswin|win32|mingw|bccwin|cygwin/) rescue false
|
|
35
|
-
SUDO = WINDOWS ? '' : ('sudo' unless ENV['SUDOLESS'])
|
|
36
|
-
|
|
37
|
-
Dir['tasks/**/*.rake'].each { |rake| load rake }
|
data/data/unicode.data
DELETED
|
Binary file
|
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
# Copyright (C) 2006-2011 Bob Aman
|
|
3
|
-
#
|
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
# you may not use this file except in compliance with the License.
|
|
6
|
-
# You may obtain a copy of the License at
|
|
7
|
-
#
|
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
#
|
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
# See the License for the specific language governing permissions and
|
|
14
|
-
# limitations under the License.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
# Have to use RubyGems to load the idn gem.
|
|
18
|
-
require "rubygems"
|
|
19
|
-
|
|
20
|
-
require "addressable/idna"
|
|
21
|
-
|
|
22
|
-
shared_examples_for "converting from unicode to ASCII" do
|
|
23
|
-
it "should convert 'www.google.com' correctly" do
|
|
24
|
-
Addressable::IDNA.to_ascii("www.google.com").should == "www.google.com"
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
it "should convert 'www.詹姆斯.com' correctly" do
|
|
28
|
-
Addressable::IDNA.to_ascii(
|
|
29
|
-
"www.詹姆斯.com"
|
|
30
|
-
).should == "www.xn--8ws00zhy3a.com"
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
it "should convert 'www.Iñtërnâtiônàlizætiøn.com' correctly" do
|
|
34
|
-
"www.Iñtërnâtiônàlizætiøn.com"
|
|
35
|
-
Addressable::IDNA.to_ascii(
|
|
36
|
-
"www.I\xC3\xB1t\xC3\xABrn\xC3\xA2ti\xC3\xB4" +
|
|
37
|
-
"n\xC3\xA0liz\xC3\xA6ti\xC3\xB8n.com"
|
|
38
|
-
).should == "www.xn--itrntinliztin-vdb0a5exd8ewcye.com"
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
it "should convert 'www.Iñtërnâtiônàlizætiøn.com' correctly" do
|
|
42
|
-
Addressable::IDNA.to_ascii(
|
|
43
|
-
"www.In\xCC\x83te\xCC\x88rna\xCC\x82tio\xCC\x82n" +
|
|
44
|
-
"a\xCC\x80liz\xC3\xA6ti\xC3\xB8n.com"
|
|
45
|
-
).should == "www.xn--itrntinliztin-vdb0a5exd8ewcye.com"
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
it "should convert " +
|
|
49
|
-
"'www.ほんとうにながいわけのわからないどめいんめいのらべるまだながくしないとたりない.w3.mag.keio.ac.jp' " +
|
|
50
|
-
"correctly" do
|
|
51
|
-
Addressable::IDNA.to_ascii(
|
|
52
|
-
"www.\343\201\273\343\202\223\343\201\250\343\201\206\343\201\253\343" +
|
|
53
|
-
"\201\252\343\201\214\343\201\204\343\202\217\343\201\221\343\201\256" +
|
|
54
|
-
"\343\202\217\343\201\213\343\202\211\343\201\252\343\201\204\343\201" +
|
|
55
|
-
"\251\343\202\201\343\201\204\343\202\223\343\202\201\343\201\204\343" +
|
|
56
|
-
"\201\256\343\202\211\343\201\271\343\202\213\343\201\276\343\201\240" +
|
|
57
|
-
"\343\201\252\343\201\214\343\201\217\343\201\227\343\201\252\343\201" +
|
|
58
|
-
"\204\343\201\250\343\201\237\343\202\212\343\201\252\343\201\204." +
|
|
59
|
-
"w3.mag.keio.ac.jp"
|
|
60
|
-
).should ==
|
|
61
|
-
"www.xn--n8jaaaaai5bhf7as8fsfk3jnknefdde3" +
|
|
62
|
-
"fg11amb5gzdb4wi9bya3kc6lra.w3.mag.keio.ac.jp"
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
it "should convert " +
|
|
66
|
-
"'www.ほんとうにながいわけのわからないどめいんめいのらべるまだながくしないとたりない.w3.mag.keio.ac.jp' " +
|
|
67
|
-
"correctly" do
|
|
68
|
-
Addressable::IDNA.to_ascii(
|
|
69
|
-
"www.\343\201\273\343\202\223\343\201\250\343\201\206\343\201\253\343" +
|
|
70
|
-
"\201\252\343\201\213\343\202\231\343\201\204\343\202\217\343\201\221" +
|
|
71
|
-
"\343\201\256\343\202\217\343\201\213\343\202\211\343\201\252\343\201" +
|
|
72
|
-
"\204\343\201\250\343\202\231\343\202\201\343\201\204\343\202\223\343" +
|
|
73
|
-
"\202\201\343\201\204\343\201\256\343\202\211\343\201\270\343\202\231" +
|
|
74
|
-
"\343\202\213\343\201\276\343\201\237\343\202\231\343\201\252\343\201" +
|
|
75
|
-
"\213\343\202\231\343\201\217\343\201\227\343\201\252\343\201\204\343" +
|
|
76
|
-
"\201\250\343\201\237\343\202\212\343\201\252\343\201\204." +
|
|
77
|
-
"w3.mag.keio.ac.jp"
|
|
78
|
-
).should ==
|
|
79
|
-
"www.xn--n8jaaaaai5bhf7as8fsfk3jnknefdde3" +
|
|
80
|
-
"fg11amb5gzdb4wi9bya3kc6lra.w3.mag.keio.ac.jp"
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
it "should convert '点心和烤鸭.w3.mag.keio.ac.jp' correctly" do
|
|
84
|
-
Addressable::IDNA.to_ascii(
|
|
85
|
-
"点心和烤鸭.w3.mag.keio.ac.jp"
|
|
86
|
-
).should == "xn--0trv4xfvn8el34t.w3.mag.keio.ac.jp"
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
it "should convert '가각갂갃간갅갆갇갈갉힢힣.com' correctly" do
|
|
90
|
-
Addressable::IDNA.to_ascii(
|
|
91
|
-
"가각갂갃간갅갆갇갈갉힢힣.com"
|
|
92
|
-
).should == "xn--o39acdefghijk5883jma.com"
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
it "should convert " +
|
|
96
|
-
"'\347\242\274\346\250\231\346\272\226\350" +
|
|
97
|
-
"\220\254\345\234\213\347\242\274.com' correctly" do
|
|
98
|
-
Addressable::IDNA.to_ascii(
|
|
99
|
-
"\347\242\274\346\250\231\346\272\226\350" +
|
|
100
|
-
"\220\254\345\234\213\347\242\274.com"
|
|
101
|
-
).should == "xn--9cs565brid46mda086o.com"
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
it "should convert 'リ宠퐱〹.com' correctly" do
|
|
105
|
-
Addressable::IDNA.to_ascii(
|
|
106
|
-
"\357\276\230\345\256\240\355\220\261\343\200\271.com"
|
|
107
|
-
).should == "xn--eek174hoxfpr4k.com"
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
it "should convert 'リ宠퐱卄.com' correctly" do
|
|
111
|
-
Addressable::IDNA.to_ascii(
|
|
112
|
-
"\343\203\252\345\256\240\355\220\261\345\215\204.com"
|
|
113
|
-
).should == "xn--eek174hoxfpr4k.com"
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
it "should convert 'ᆵ' correctly" do
|
|
117
|
-
Addressable::IDNA.to_ascii(
|
|
118
|
-
"\341\206\265"
|
|
119
|
-
).should == "xn--4ud"
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
it "should convert 'ᆵ' correctly" do
|
|
123
|
-
Addressable::IDNA.to_ascii(
|
|
124
|
-
"\357\276\257"
|
|
125
|
-
).should == "xn--4ud"
|
|
126
|
-
end
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
shared_examples_for "converting from ASCII to unicode" do
|
|
130
|
-
it "should convert 'www.google.com' correctly" do
|
|
131
|
-
Addressable::IDNA.to_unicode("www.google.com").should == "www.google.com"
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
it "should convert 'www.詹姆斯.com' correctly" do
|
|
135
|
-
Addressable::IDNA.to_unicode(
|
|
136
|
-
"www.xn--8ws00zhy3a.com"
|
|
137
|
-
).should == "www.詹姆斯.com"
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
it "should convert 'www.iñtërnâtiônàlizætiøn.com' correctly" do
|
|
141
|
-
Addressable::IDNA.to_unicode(
|
|
142
|
-
"www.xn--itrntinliztin-vdb0a5exd8ewcye.com"
|
|
143
|
-
).should == "www.iñtërnâtiônàlizætiøn.com"
|
|
144
|
-
end
|
|
145
|
-
|
|
146
|
-
it "should convert " +
|
|
147
|
-
"'www.ほんとうにながいわけのわからないどめいんめいのらべるまだながくしないとたりない.w3.mag.keio.ac.jp' " +
|
|
148
|
-
"correctly" do
|
|
149
|
-
Addressable::IDNA.to_unicode(
|
|
150
|
-
"www.xn--n8jaaaaai5bhf7as8fsfk3jnknefdde3" +
|
|
151
|
-
"fg11amb5gzdb4wi9bya3kc6lra.w3.mag.keio.ac.jp"
|
|
152
|
-
).should ==
|
|
153
|
-
"www.ほんとうにながいわけのわからないどめいんめいのらべるまだながくしないとたりない.w3.mag.keio.ac.jp"
|
|
154
|
-
end
|
|
155
|
-
|
|
156
|
-
it "should convert '点心和烤鸭.w3.mag.keio.ac.jp' correctly" do
|
|
157
|
-
Addressable::IDNA.to_unicode(
|
|
158
|
-
"xn--0trv4xfvn8el34t.w3.mag.keio.ac.jp"
|
|
159
|
-
).should == "点心和烤鸭.w3.mag.keio.ac.jp"
|
|
160
|
-
end
|
|
161
|
-
|
|
162
|
-
it "should convert '가각갂갃간갅갆갇갈갉힢힣.com' correctly" do
|
|
163
|
-
Addressable::IDNA.to_unicode(
|
|
164
|
-
"xn--o39acdefghijk5883jma.com"
|
|
165
|
-
).should == "가각갂갃간갅갆갇갈갉힢힣.com"
|
|
166
|
-
end
|
|
167
|
-
|
|
168
|
-
it "should convert " +
|
|
169
|
-
"'\347\242\274\346\250\231\346\272\226\350" +
|
|
170
|
-
"\220\254\345\234\213\347\242\274.com' correctly" do
|
|
171
|
-
Addressable::IDNA.to_unicode(
|
|
172
|
-
"xn--9cs565brid46mda086o.com"
|
|
173
|
-
).should ==
|
|
174
|
-
"\347\242\274\346\250\231\346\272\226\350" +
|
|
175
|
-
"\220\254\345\234\213\347\242\274.com"
|
|
176
|
-
end
|
|
177
|
-
|
|
178
|
-
it "should convert 'リ宠퐱卄.com' correctly" do
|
|
179
|
-
Addressable::IDNA.to_unicode(
|
|
180
|
-
"xn--eek174hoxfpr4k.com"
|
|
181
|
-
).should == "\343\203\252\345\256\240\355\220\261\345\215\204.com"
|
|
182
|
-
end
|
|
183
|
-
|
|
184
|
-
it "should convert 'ᆵ' correctly" do
|
|
185
|
-
Addressable::IDNA.to_unicode(
|
|
186
|
-
"xn--4ud"
|
|
187
|
-
).should == "\341\206\265"
|
|
188
|
-
end
|
|
189
|
-
end
|
|
190
|
-
|
|
191
|
-
describe Addressable::IDNA, "when using the pure-Ruby implementation" do
|
|
192
|
-
before do
|
|
193
|
-
Addressable.send(:remove_const, :IDNA)
|
|
194
|
-
load "addressable/idna/pure.rb"
|
|
195
|
-
end
|
|
196
|
-
|
|
197
|
-
it_should_behave_like "converting from unicode to ASCII"
|
|
198
|
-
it_should_behave_like "converting from ASCII to unicode"
|
|
199
|
-
|
|
200
|
-
begin
|
|
201
|
-
require "fiber"
|
|
202
|
-
|
|
203
|
-
it "should not blow up inside fibers" do
|
|
204
|
-
f = Fiber.new do
|
|
205
|
-
Addressable.send(:remove_const, :IDNA)
|
|
206
|
-
load "addressable/idna/pure.rb"
|
|
207
|
-
end
|
|
208
|
-
f.resume
|
|
209
|
-
end
|
|
210
|
-
rescue LoadError
|
|
211
|
-
# Fibers aren't supported in this version of Ruby, skip this test.
|
|
212
|
-
warn('Fibers unsupported.')
|
|
213
|
-
end
|
|
214
|
-
end
|
|
215
|
-
|
|
216
|
-
begin
|
|
217
|
-
require "idn"
|
|
218
|
-
|
|
219
|
-
describe Addressable::IDNA, "when using the native-code implementation" do
|
|
220
|
-
before do
|
|
221
|
-
Addressable.send(:remove_const, :IDNA)
|
|
222
|
-
load "addressable/idna/native.rb"
|
|
223
|
-
end
|
|
224
|
-
|
|
225
|
-
it_should_behave_like "converting from unicode to ASCII"
|
|
226
|
-
it_should_behave_like "converting from ASCII to unicode"
|
|
227
|
-
end
|
|
228
|
-
rescue LoadError
|
|
229
|
-
# Cannot test the native implementation without libidn support.
|
|
230
|
-
warn('Could not load native IDN implementation.')
|
|
231
|
-
end
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
# Copyright (C) 2006-2011 Bob Aman
|
|
3
|
-
#
|
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
# you may not use this file except in compliance with the License.
|
|
6
|
-
# You may obtain a copy of the License at
|
|
7
|
-
#
|
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
#
|
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
# See the License for the specific language governing permissions and
|
|
14
|
-
# limitations under the License.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
require "addressable/uri"
|
|
18
|
-
require "net/http"
|
|
19
|
-
|
|
20
|
-
describe Net::HTTP do
|
|
21
|
-
it "should be compatible with Addressable" do
|
|
22
|
-
response_body =
|
|
23
|
-
Net::HTTP.get(Addressable::URI.parse('http://www.google.com/'))
|
|
24
|
-
response_body.should_not be_nil
|
|
25
|
-
end
|
|
26
|
-
end
|