addressable 2.3.2 → 2.9.0
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 +214 -28
- 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 +266 -64
- data/lib/addressable/uri.rb +664 -307
- data/lib/addressable/version.rb +5 -4
- data/lib/addressable.rb +4 -0
- metadata +51 -89
- data/Gemfile +0 -17
- 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 -1001
- data/spec/addressable/uri_spec.rb +0 -5064
- data/tasks/clobber.rake +0 -2
- data/tasks/gem.rake +0 -85
- 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 = 9
|
|
26
|
+
TINY = 0
|
|
26
27
|
|
|
27
28
|
STRING = [MAJOR, MINOR, TINY].join('.')
|
|
28
29
|
end
|
data/lib/addressable.rb
ADDED
metadata
CHANGED
|
@@ -1,114 +1,76 @@
|
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: addressable
|
|
3
|
-
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
5
|
-
version: 2.3.2
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 2.9.0
|
|
6
5
|
platform: ruby
|
|
7
|
-
authors:
|
|
6
|
+
authors:
|
|
8
7
|
- Bob Aman
|
|
9
|
-
autorequire:
|
|
10
8
|
bindir: bin
|
|
11
9
|
cert_chain: []
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
|
19
|
-
none: false
|
|
20
|
-
requirements:
|
|
21
|
-
- - ">="
|
|
22
|
-
- !ruby/object:Gem::Version
|
|
23
|
-
version: 0.7.3
|
|
24
|
-
type: :development
|
|
25
|
-
version_requirements: *id001
|
|
26
|
-
- !ruby/object:Gem::Dependency
|
|
27
|
-
name: rspec
|
|
28
|
-
prerelease: false
|
|
29
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
|
30
|
-
none: false
|
|
31
|
-
requirements:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: public_suffix
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
32
16
|
- - ">="
|
|
33
|
-
- !ruby/object:Gem::Version
|
|
34
|
-
version: 2.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: 2.0.2
|
|
19
|
+
- - "<"
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '8.0'
|
|
22
|
+
type: :runtime
|
|
39
23
|
prerelease: false
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
requirements:
|
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
requirements:
|
|
43
26
|
- - ">="
|
|
44
|
-
- !ruby/object:Gem::Version
|
|
45
|
-
version: 0.
|
|
46
|
-
|
|
47
|
-
|
|
27
|
+
- !ruby/object:Gem::Version
|
|
28
|
+
version: 2.0.2
|
|
29
|
+
- - "<"
|
|
30
|
+
- !ruby/object:Gem::Version
|
|
31
|
+
version: '8.0'
|
|
48
32
|
description: |
|
|
49
|
-
Addressable is
|
|
50
|
-
Ruby's standard library. It
|
|
51
|
-
|
|
52
|
-
|
|
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.
|
|
53
36
|
email: bob@sporkmonger.com
|
|
54
37
|
executables: []
|
|
55
|
-
|
|
56
38
|
extensions: []
|
|
57
|
-
|
|
58
|
-
|
|
39
|
+
extra_rdoc_files:
|
|
40
|
+
- README.md
|
|
41
|
+
files:
|
|
42
|
+
- CHANGELOG.md
|
|
43
|
+
- LICENSE.txt
|
|
59
44
|
- README.md
|
|
60
|
-
|
|
45
|
+
- lib/addressable.rb
|
|
46
|
+
- lib/addressable/idna.rb
|
|
61
47
|
- lib/addressable/idna/native.rb
|
|
62
48
|
- lib/addressable/idna/pure.rb
|
|
63
|
-
- lib/addressable/idna.rb
|
|
64
49
|
- lib/addressable/template.rb
|
|
65
50
|
- lib/addressable/uri.rb
|
|
66
51
|
- lib/addressable/version.rb
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
-
|
|
74
|
-
- tasks/git.rake
|
|
75
|
-
- tasks/metrics.rake
|
|
76
|
-
- tasks/rspec.rake
|
|
77
|
-
- tasks/rubyforge.rake
|
|
78
|
-
- tasks/yard.rake
|
|
79
|
-
- website/index.html
|
|
80
|
-
- CHANGELOG.md
|
|
81
|
-
- Gemfile
|
|
82
|
-
- LICENSE.txt
|
|
83
|
-
- Rakefile
|
|
84
|
-
- README.md
|
|
85
|
-
homepage: http://addressable.rubyforge.org/
|
|
86
|
-
licenses: []
|
|
87
|
-
|
|
88
|
-
post_install_message:
|
|
89
|
-
rdoc_options:
|
|
90
|
-
- --main
|
|
52
|
+
homepage: https://github.com/sporkmonger/addressable
|
|
53
|
+
licenses:
|
|
54
|
+
- Apache-2.0
|
|
55
|
+
metadata:
|
|
56
|
+
changelog_uri: https://github.com/sporkmonger/addressable/blob/main/CHANGELOG.md#v2.9.0
|
|
57
|
+
rdoc_options:
|
|
58
|
+
- "--main"
|
|
91
59
|
- README.md
|
|
92
|
-
require_paths:
|
|
60
|
+
require_paths:
|
|
93
61
|
- lib
|
|
94
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
|
95
|
-
|
|
96
|
-
requirements:
|
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
63
|
+
requirements:
|
|
97
64
|
- - ">="
|
|
98
|
-
- !ruby/object:Gem::Version
|
|
99
|
-
version:
|
|
100
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
|
-
|
|
102
|
-
requirements:
|
|
65
|
+
- !ruby/object:Gem::Version
|
|
66
|
+
version: '2.2'
|
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
|
+
requirements:
|
|
103
69
|
- - ">="
|
|
104
|
-
- !ruby/object:Gem::Version
|
|
105
|
-
version:
|
|
70
|
+
- !ruby/object:Gem::Version
|
|
71
|
+
version: '0'
|
|
106
72
|
requirements: []
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
rubygems_version: 1.8.15
|
|
110
|
-
signing_key:
|
|
111
|
-
specification_version: 3
|
|
73
|
+
rubygems_version: 4.0.6
|
|
74
|
+
specification_version: 4
|
|
112
75
|
summary: URI Implementation
|
|
113
76
|
test_files: []
|
|
114
|
-
|
data/Gemfile
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
source 'https://rubygems.org'
|
|
2
|
-
|
|
3
|
-
group :development do
|
|
4
|
-
gem 'launchy'
|
|
5
|
-
gem 'yard'
|
|
6
|
-
gem 'redcarpet'
|
|
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
|
-
|
|
17
|
-
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
|