ryodo 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +17 -0
- data/.travis.yml +7 -5
- data/Gemfile +5 -0
- data/LICENSE +1 -1
- data/README.md +18 -101
- data/Rakefile +9 -9
- data/data/suffix.dat +342 -7
- data/lib/ryodo/convenience.rb +2 -0
- data/lib/ryodo/domain.rb +37 -13
- data/lib/ryodo/ext/uri.rb +8 -4
- data/lib/ryodo/methods.rb +0 -1
- data/lib/ryodo/parser.rb +2 -2
- data/lib/ryodo/rule.rb +3 -3
- data/lib/ryodo/rule_set.rb +51 -37
- data/lib/ryodo/suffix_list.rb +11 -13
- data/lib/ryodo/suffix_list_fetcher.rb +1 -0
- data/lib/ryodo/version.rb +1 -1
- data/ryodo.gemspec +7 -7
- data/spec/_files/mozilla_effective_tld_names.dat +975 -63
- data/spec/ryodo/suffix_list_fetcher_spec.rb +7 -6
- data/spec/ryodo/suffix_list_spec.rb +15 -16
- data/spec/spec_helper.rb +16 -7
- data/spec/suffix_checker.rb +130 -0
- metadata +12 -26
- data/checks/matching.rb +0 -107
- data/spec/ryodo_spec.rb +0 -5
@@ -1,7 +1,8 @@
|
|
1
1
|
require "ryodo/suffix_list_fetcher"
|
2
2
|
require "spec_helper"
|
3
3
|
|
4
|
-
describe Ryodo::SuffixListFetcher do
|
4
|
+
RSpec.describe Ryodo::SuffixListFetcher do
|
5
|
+
subject { described_class }
|
5
6
|
let(:custom_uri) { "http://custom.suffix.list.example.com/foo-bar.dat" }
|
6
7
|
let(:custom_storage) { "#{RYODO_TMP_ROOT}/custom-storage-path.dat" }
|
7
8
|
|
@@ -12,21 +13,21 @@ describe Ryodo::SuffixListFetcher do
|
|
12
13
|
end
|
13
14
|
|
14
15
|
it "#new creates a new instance with predefined vars" do
|
15
|
-
fetcher =
|
16
|
+
fetcher = subject.new
|
16
17
|
|
17
18
|
expect(fetcher.instance_variable_get("@uri")).to eq URI(Ryodo::PUBLIC_SUFFIX_DATA_URI)
|
18
19
|
expect(fetcher.instance_variable_get("@store")).to be Ryodo::PUBLIC_SUFFIX_STORE
|
19
20
|
end
|
20
21
|
|
21
22
|
it "#new creates a new instance with custom vars" do
|
22
|
-
fetcher =
|
23
|
+
fetcher = subject.new(custom_uri, custom_storage)
|
23
24
|
|
24
25
|
expect(fetcher.instance_variable_get("@uri")).to eq URI(custom_uri)
|
25
26
|
expect(fetcher.instance_variable_get("@store")).to be custom_storage
|
26
27
|
end
|
27
28
|
|
28
29
|
context "data retrieval and storage" do
|
29
|
-
let(:fetcher) {
|
30
|
+
let(:fetcher) { subject.new }
|
30
31
|
|
31
32
|
it "#fetch_data retrieves remote data" do
|
32
33
|
first_line = /This Source Code Form is subject to the terms of the Mozilla Public/
|
@@ -58,11 +59,11 @@ describe Ryodo::SuffixListFetcher do
|
|
58
59
|
let(:storage) { "#{RYODO_TMP_ROOT}/suffixes.dat" }
|
59
60
|
|
60
61
|
it "and returns true if successful" do
|
61
|
-
expect(
|
62
|
+
expect(subject.fetch_and_save!(valid_uri, storage)).to be true
|
62
63
|
end
|
63
64
|
|
64
65
|
it "and returns false if something failed" do
|
65
|
-
expect(
|
66
|
+
expect(subject.fetch_and_save!(invalid_uri, storage)).to be false
|
66
67
|
end
|
67
68
|
end
|
68
69
|
end
|
@@ -1,46 +1,45 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
describe Ryodo::SuffixList do
|
4
|
-
|
3
|
+
RSpec.describe Ryodo::SuffixList do
|
4
|
+
subject { described_class }
|
5
5
|
|
6
|
+
context "singleton" do
|
6
7
|
it "cannot be instanciated via #new" do
|
7
|
-
expect{
|
8
|
+
expect { subject.new }.to raise_error
|
8
9
|
end
|
9
10
|
|
10
11
|
it "creates instance by calling the class itself" do
|
11
|
-
|
12
|
-
|
12
|
+
expect(subject).to receive(:instance)
|
13
|
+
subject.send(:"SuffixList")
|
13
14
|
end
|
14
15
|
|
15
16
|
it "has .instance" do
|
16
|
-
expect(
|
17
|
+
expect(subject.methods).to include(:instance)
|
17
18
|
end
|
18
19
|
|
19
20
|
it "instance check" do
|
20
|
-
o1 =
|
21
|
-
o2 =
|
21
|
+
o1 = subject.instance
|
22
|
+
o2 = subject.instance
|
22
23
|
|
23
|
-
expect(o1).to be
|
24
|
+
expect(o1).to be(o2)
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
27
28
|
context "methods" do
|
28
|
-
let(:described_instance) {
|
29
|
+
let(:described_instance) { subject.instance }
|
29
30
|
|
30
31
|
it ".reload can retrieve a fresh suffix list" do
|
31
32
|
expect(described_instance).to receive(:load_file).and_return(true)
|
32
|
-
|
33
|
+
subject.reload
|
33
34
|
end
|
34
35
|
|
35
36
|
it ".reload fails if given file doesn't exist" do
|
36
|
-
expect {
|
37
|
+
expect { subject.reload("#{RYODO_TMP_ROOT}/invalid-file.dat") }.to raise_error
|
37
38
|
end
|
38
39
|
|
39
40
|
it ".list returns an array of arrays" do
|
40
|
-
expect(
|
41
|
-
expect(
|
42
|
-
described_class.list.all? { |e| e.is_a?(Array) }
|
43
|
-
).to be true
|
41
|
+
expect(subject.list).to be_an(Array)
|
42
|
+
expect(subject.list.all? { |e| e.is_a?(Array) }).to be(true)
|
44
43
|
end
|
45
44
|
end
|
46
45
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,5 +1,13 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
if ENV["TRAVIS"] || ENV["CI"]
|
2
|
+
require "codeclimate-test-reporter"
|
3
|
+
require "coveralls"
|
4
|
+
|
5
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
6
|
+
Coveralls::SimpleCov::Formatter,
|
7
|
+
CodeClimate::TestReporter::Formatter
|
8
|
+
]
|
9
|
+
SimpleCov.start
|
10
|
+
end
|
3
11
|
|
4
12
|
require "fileutils"
|
5
13
|
require "fakeweb"
|
@@ -9,16 +17,17 @@ require "ryodo"
|
|
9
17
|
RYODO_SPEC_ROOT = File.expand_path("..", __FILE__)
|
10
18
|
RYODO_TMP_ROOT = File.expand_path("../../tmp/spec", __FILE__)
|
11
19
|
|
12
|
-
FileUtils.mkdir_p RYODO_TMP_ROOT unless File.
|
20
|
+
FileUtils.mkdir_p RYODO_TMP_ROOT unless File.exist?(RYODO_TMP_ROOT)
|
13
21
|
|
14
|
-
FakeWeb.register_uri(
|
22
|
+
FakeWeb.register_uri(
|
23
|
+
:get,
|
15
24
|
Ryodo::PUBLIC_SUFFIX_DATA_URI,
|
16
|
-
:
|
25
|
+
body: File.read("#{RYODO_SPEC_ROOT}/_files/mozilla_effective_tld_names.dat")
|
17
26
|
)
|
18
27
|
|
19
28
|
FakeWeb.register_uri(
|
20
29
|
:get,
|
21
30
|
"#{Ryodo::PUBLIC_SUFFIX_DATA_URI}&invalid_file",
|
22
|
-
:
|
23
|
-
:
|
31
|
+
body: "Oops!",
|
32
|
+
status: [404, "Not Found"]
|
24
33
|
)
|
@@ -0,0 +1,130 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$LOAD_PATH << "lib"
|
3
|
+
require "ryodo"
|
4
|
+
|
5
|
+
module SuffixChecker
|
6
|
+
module_function
|
7
|
+
|
8
|
+
def check_public_suffix(query, expectation)
|
9
|
+
query = Ryodo.parse(query)
|
10
|
+
calculated = query.domain.nil? ? "NULL" : query.domain
|
11
|
+
result = calculated == expectation
|
12
|
+
passed = result ? " OK" : "FAIL"
|
13
|
+
|
14
|
+
puts "#{passed} === Q: #{query.ljust(26)} | #{expectation.rjust(16)} <=> #{calculated.ljust(16)}"
|
15
|
+
|
16
|
+
result
|
17
|
+
end
|
18
|
+
|
19
|
+
def run!
|
20
|
+
results = []
|
21
|
+
|
22
|
+
# Following test data can be found at:
|
23
|
+
# <http://mxr.mozilla.org/mozilla-central/source/netwerk/test/unit/data/test_psl.txt?raw=1>
|
24
|
+
|
25
|
+
# NULL input.
|
26
|
+
results << check_public_suffix("NULL", "NULL")
|
27
|
+
# Mixed case.
|
28
|
+
results << check_public_suffix("COM", "NULL")
|
29
|
+
results << check_public_suffix("example.COM", "example.com")
|
30
|
+
results << check_public_suffix("WwW.example.COM", "example.com")
|
31
|
+
# Leading dot.
|
32
|
+
results << check_public_suffix(".com", "NULL")
|
33
|
+
results << check_public_suffix(".example", "NULL")
|
34
|
+
results << check_public_suffix(".example.com", "NULL")
|
35
|
+
results << check_public_suffix(".example.example", "NULL")
|
36
|
+
# Unlisted TLD.
|
37
|
+
results << check_public_suffix("example", "NULL")
|
38
|
+
results << check_public_suffix("example.example", "example.example")
|
39
|
+
results << check_public_suffix("b.example.example", "example.example")
|
40
|
+
results << check_public_suffix("a.b.example.example", "example.example")
|
41
|
+
# Listed, but non-Internet, TLD.
|
42
|
+
# results << check_public_suffix('local', 'NULL')
|
43
|
+
# results << check_public_suffix('example.local', 'NULL')
|
44
|
+
# results << check_public_suffix('b.example.local', 'NULL')
|
45
|
+
# results << check_public_suffix('a.b.example.local', 'NULL')
|
46
|
+
# TLD with only 1 rule.
|
47
|
+
results << check_public_suffix("biz", "NULL")
|
48
|
+
results << check_public_suffix("domain.biz", "domain.biz")
|
49
|
+
results << check_public_suffix("b.domain.biz", "domain.biz")
|
50
|
+
results << check_public_suffix("a.b.domain.biz", "domain.biz")
|
51
|
+
# TLD with some 2-level rules.
|
52
|
+
results << check_public_suffix("com", "NULL")
|
53
|
+
results << check_public_suffix("example.com", "example.com")
|
54
|
+
results << check_public_suffix("b.example.com", "example.com")
|
55
|
+
results << check_public_suffix("a.b.example.com", "example.com")
|
56
|
+
results << check_public_suffix("uk.com", "NULL")
|
57
|
+
results << check_public_suffix("example.uk.com", "example.uk.com")
|
58
|
+
results << check_public_suffix("b.example.uk.com", "example.uk.com")
|
59
|
+
results << check_public_suffix("a.b.example.uk.com", "example.uk.com")
|
60
|
+
results << check_public_suffix("test.ac", "test.ac")
|
61
|
+
# TLD with only 1 (wildcard) rule.
|
62
|
+
results << check_public_suffix("cy", "NULL")
|
63
|
+
results << check_public_suffix("c.cy", "NULL")
|
64
|
+
results << check_public_suffix("b.c.cy", "b.c.cy")
|
65
|
+
results << check_public_suffix("a.b.c.cy", "b.c.cy")
|
66
|
+
# More complex TLD.
|
67
|
+
results << check_public_suffix("jp", "NULL")
|
68
|
+
results << check_public_suffix("test.jp", "test.jp")
|
69
|
+
results << check_public_suffix("www.test.jp", "test.jp")
|
70
|
+
results << check_public_suffix("ac.jp", "NULL")
|
71
|
+
results << check_public_suffix("test.ac.jp", "test.ac.jp")
|
72
|
+
results << check_public_suffix("www.test.ac.jp", "test.ac.jp")
|
73
|
+
results << check_public_suffix("kyoto.jp", "NULL")
|
74
|
+
results << check_public_suffix("test.kyoto.jp", "test.kyoto.jp")
|
75
|
+
results << check_public_suffix("ide.kyoto.jp", "NULL")
|
76
|
+
results << check_public_suffix("b.ide.kyoto.jp", "b.ide.kyoto.jp")
|
77
|
+
results << check_public_suffix("a.b.ide.kyoto.jp", "b.ide.kyoto.jp")
|
78
|
+
results << check_public_suffix("c.kobe.jp", "NULL")
|
79
|
+
results << check_public_suffix("b.c.kobe.jp", "b.c.kobe.jp")
|
80
|
+
results << check_public_suffix("a.b.c.kobe.jp", "b.c.kobe.jp")
|
81
|
+
results << check_public_suffix("city.kobe.jp", "city.kobe.jp")
|
82
|
+
results << check_public_suffix("www.city.kobe.jp", "city.kobe.jp")
|
83
|
+
# TLD with a wildcard rule and exceptions.
|
84
|
+
results << check_public_suffix("ck", "NULL")
|
85
|
+
results << check_public_suffix("test.ck", "NULL")
|
86
|
+
results << check_public_suffix("b.test.ck", "b.test.ck")
|
87
|
+
results << check_public_suffix("a.b.test.ck", "b.test.ck")
|
88
|
+
results << check_public_suffix("www.ck", "www.ck")
|
89
|
+
results << check_public_suffix("www.www.ck", "www.ck")
|
90
|
+
# US K12.
|
91
|
+
results << check_public_suffix("us", "NULL")
|
92
|
+
results << check_public_suffix("test.us", "test.us")
|
93
|
+
results << check_public_suffix("www.test.us", "test.us")
|
94
|
+
results << check_public_suffix("ak.us", "NULL")
|
95
|
+
results << check_public_suffix("test.ak.us", "test.ak.us")
|
96
|
+
results << check_public_suffix("www.test.ak.us", "test.ak.us")
|
97
|
+
results << check_public_suffix("k12.ak.us", "NULL")
|
98
|
+
results << check_public_suffix("test.k12.ak.us", "test.k12.ak.us")
|
99
|
+
results << check_public_suffix("www.test.k12.ak.us", "test.k12.ak.us")
|
100
|
+
# IDN labels.
|
101
|
+
results << check_public_suffix("食狮.com.cn", "食狮.com.cn")
|
102
|
+
results << check_public_suffix("食狮.公司.cn", "食狮.公司.cn")
|
103
|
+
results << check_public_suffix("www.食狮.公司.cn", "食狮.公司.cn")
|
104
|
+
results << check_public_suffix("shishi.公司.cn", "shishi.公司.cn")
|
105
|
+
results << check_public_suffix("公司.cn", "NULL")
|
106
|
+
results << check_public_suffix("食狮.中国", "食狮.中国")
|
107
|
+
results << check_public_suffix("www.食狮.中国", "食狮.中国")
|
108
|
+
results << check_public_suffix("shishi.中国", "shishi.中国")
|
109
|
+
results << check_public_suffix("中国", "NULL")
|
110
|
+
# Same as above, but punycoded.
|
111
|
+
results << check_public_suffix('xn--85x722f.com.cn', 'xn--85x722f.com.cn')
|
112
|
+
# results << check_public_suffix('xn--85x722f.xn--55qx5d.cn', 'xn--85x722f.xn--55qx5d.cn')
|
113
|
+
# results << check_public_suffix('www.xn--85x722f.xn--55qx5d.cn', 'xn--85x722f.xn--55qx5d.cn')
|
114
|
+
# results << check_public_suffix('shishi.xn--55qx5d.cn', 'shishi.xn--55qx5d.cn')
|
115
|
+
# results << check_public_suffix('xn--55qx5d.cn', 'NULL')
|
116
|
+
# results << check_public_suffix('xn--85x722f.xn--fiqs8s', 'xn--85x722f.xn--fiqs8s')
|
117
|
+
# results << check_public_suffix('www.xn--85x722f.xn--fiqs8s', 'xn--85x722f.xn--fiqs8s')
|
118
|
+
# results << check_public_suffix('shishi.xn--fiqs8s', 'shishi.xn--fiqs8s')
|
119
|
+
results << check_public_suffix('xn--fiqs8s', 'NULL')
|
120
|
+
|
121
|
+
exit_code = results.all? ? 0 : 1
|
122
|
+
case exit_code
|
123
|
+
when 0 then puts "All okay! ✔"
|
124
|
+
when 1 then puts "Some checks failed! ✘"
|
125
|
+
end
|
126
|
+
exit(exit_code)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
SuffixChecker.run!
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ryodo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christoph Grabo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -28,44 +28,30 @@ dependencies:
|
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '1.5'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '1.5'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: coveralls
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
31
|
+
- - ">="
|
46
32
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0
|
33
|
+
version: '0'
|
48
34
|
type: :development
|
49
35
|
prerelease: false
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
51
37
|
requirements:
|
52
|
-
- - "
|
38
|
+
- - ">="
|
53
39
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0
|
40
|
+
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: rspec
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
45
|
- - "~>"
|
60
46
|
- !ruby/object:Gem::Version
|
61
|
-
version: 3.
|
47
|
+
version: 3.2.0
|
62
48
|
type: :development
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
52
|
- - "~>"
|
67
53
|
- !ruby/object:Gem::Version
|
68
|
-
version: 3.
|
54
|
+
version: 3.2.0
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: fakeweb
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -118,13 +104,13 @@ extra_rdoc_files: []
|
|
118
104
|
files:
|
119
105
|
- ".gitignore"
|
120
106
|
- ".rspec"
|
107
|
+
- ".rubocop.yml"
|
121
108
|
- ".travis.yml"
|
122
109
|
- Gemfile
|
123
110
|
- Gemfile.lock
|
124
111
|
- LICENSE
|
125
112
|
- README.md
|
126
113
|
- Rakefile
|
127
|
-
- checks/matching.rb
|
128
114
|
- data/suffix.dat
|
129
115
|
- lib/ryodo.rb
|
130
116
|
- lib/ryodo/convenience.rb
|
@@ -143,8 +129,8 @@ files:
|
|
143
129
|
- spec/_files/mozilla_effective_tld_names.dat
|
144
130
|
- spec/ryodo/suffix_list_fetcher_spec.rb
|
145
131
|
- spec/ryodo/suffix_list_spec.rb
|
146
|
-
- spec/ryodo_spec.rb
|
147
132
|
- spec/spec_helper.rb
|
133
|
+
- spec/suffix_checker.rb
|
148
134
|
homepage: http://github.com/asaaki/ryodo
|
149
135
|
licenses:
|
150
136
|
- MIT
|
@@ -165,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
151
|
version: '0'
|
166
152
|
requirements: []
|
167
153
|
rubyforge_project:
|
168
|
-
rubygems_version: 2.
|
154
|
+
rubygems_version: 2.4.5
|
169
155
|
signing_key:
|
170
156
|
specification_version: 4
|
171
157
|
summary: ryōdo【領土】 りょうど — A domain name parser using public suffix list
|
@@ -173,6 +159,6 @@ test_files:
|
|
173
159
|
- spec/_files/mozilla_effective_tld_names.dat
|
174
160
|
- spec/ryodo/suffix_list_fetcher_spec.rb
|
175
161
|
- spec/ryodo/suffix_list_spec.rb
|
176
|
-
- spec/ryodo_spec.rb
|
177
162
|
- spec/spec_helper.rb
|
163
|
+
- spec/suffix_checker.rb
|
178
164
|
has_rdoc:
|
data/checks/matching.rb
DELETED
@@ -1,107 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
$LOAD_PATH << "lib"
|
3
|
-
require "ryodo"
|
4
|
-
|
5
|
-
def checkPublicSuffix(query, expectation)
|
6
|
-
query = Ryodo[query]
|
7
|
-
calculated = query.domain.nil? ? "NULL" : query.domain
|
8
|
-
passed = calculated == expectation ? " OK" : "FAIL"
|
9
|
-
|
10
|
-
puts "#{passed} === Q: #{query.ljust(26)} | #{expectation.rjust(16)} <=> #{calculated.ljust(16)}"
|
11
|
-
end
|
12
|
-
|
13
|
-
# NULL input.
|
14
|
-
checkPublicSuffix('NULL', 'NULL')
|
15
|
-
# Mixed case.
|
16
|
-
checkPublicSuffix('COM', 'NULL')
|
17
|
-
checkPublicSuffix('example.COM', 'example.com')
|
18
|
-
checkPublicSuffix('WwW.example.COM', 'example.com')
|
19
|
-
# Leading dot.
|
20
|
-
checkPublicSuffix('.com', 'NULL')
|
21
|
-
checkPublicSuffix('.example', 'NULL')
|
22
|
-
checkPublicSuffix('.example.com', 'NULL')
|
23
|
-
checkPublicSuffix('.example.example', 'NULL')
|
24
|
-
# Unlisted TLD.
|
25
|
-
checkPublicSuffix('example', 'NULL')
|
26
|
-
checkPublicSuffix('example.example', 'example.example')
|
27
|
-
checkPublicSuffix('b.example.example', 'example.example')
|
28
|
-
checkPublicSuffix('a.b.example.example', 'example.example')
|
29
|
-
# Listed, but non-Internet, TLD.
|
30
|
-
#checkPublicSuffix('local', 'NULL')
|
31
|
-
#checkPublicSuffix('example.local', 'NULL')
|
32
|
-
#checkPublicSuffix('b.example.local', 'NULL')
|
33
|
-
#checkPublicSuffix('a.b.example.local', 'NULL')
|
34
|
-
# TLD with only 1 rule.
|
35
|
-
checkPublicSuffix('biz', 'NULL')
|
36
|
-
checkPublicSuffix('domain.biz', 'domain.biz')
|
37
|
-
checkPublicSuffix('b.domain.biz', 'domain.biz')
|
38
|
-
checkPublicSuffix('a.b.domain.biz', 'domain.biz')
|
39
|
-
# TLD with some 2-level rules.
|
40
|
-
checkPublicSuffix('com', 'NULL')
|
41
|
-
checkPublicSuffix('example.com', 'example.com')
|
42
|
-
checkPublicSuffix('b.example.com', 'example.com')
|
43
|
-
checkPublicSuffix('a.b.example.com', 'example.com')
|
44
|
-
checkPublicSuffix('uk.com', 'NULL')
|
45
|
-
checkPublicSuffix('example.uk.com', 'example.uk.com')
|
46
|
-
checkPublicSuffix('b.example.uk.com', 'example.uk.com')
|
47
|
-
checkPublicSuffix('a.b.example.uk.com', 'example.uk.com')
|
48
|
-
checkPublicSuffix('test.ac', 'test.ac')
|
49
|
-
# TLD with only 1 (wildcard) rule.
|
50
|
-
checkPublicSuffix('cy', 'NULL')
|
51
|
-
checkPublicSuffix('c.cy', 'NULL')
|
52
|
-
checkPublicSuffix('b.c.cy', 'b.c.cy')
|
53
|
-
checkPublicSuffix('a.b.c.cy', 'b.c.cy')
|
54
|
-
# More complex TLD.
|
55
|
-
checkPublicSuffix('jp', 'NULL')
|
56
|
-
checkPublicSuffix('test.jp', 'test.jp')
|
57
|
-
checkPublicSuffix('www.test.jp', 'test.jp')
|
58
|
-
checkPublicSuffix('ac.jp', 'NULL')
|
59
|
-
checkPublicSuffix('test.ac.jp', 'test.ac.jp')
|
60
|
-
checkPublicSuffix('www.test.ac.jp', 'test.ac.jp')
|
61
|
-
checkPublicSuffix('kyoto.jp', 'NULL')
|
62
|
-
checkPublicSuffix('test.kyoto.jp', 'test.kyoto.jp')
|
63
|
-
checkPublicSuffix('ide.kyoto.jp', 'NULL')
|
64
|
-
checkPublicSuffix('b.ide.kyoto.jp', 'b.ide.kyoto.jp')
|
65
|
-
checkPublicSuffix('a.b.ide.kyoto.jp', 'b.ide.kyoto.jp')
|
66
|
-
checkPublicSuffix('c.kobe.jp', 'NULL')
|
67
|
-
checkPublicSuffix('b.c.kobe.jp', 'b.c.kobe.jp')
|
68
|
-
checkPublicSuffix('a.b.c.kobe.jp', 'b.c.kobe.jp')
|
69
|
-
checkPublicSuffix('city.kobe.jp', 'city.kobe.jp')
|
70
|
-
checkPublicSuffix('www.city.kobe.jp', 'city.kobe.jp')
|
71
|
-
# TLD with a wildcard rule and exceptions.
|
72
|
-
checkPublicSuffix('ck', 'NULL')
|
73
|
-
checkPublicSuffix('test.ck', 'NULL')
|
74
|
-
checkPublicSuffix('b.test.ck', 'b.test.ck')
|
75
|
-
checkPublicSuffix('a.b.test.ck', 'b.test.ck')
|
76
|
-
checkPublicSuffix('www.ck', 'www.ck')
|
77
|
-
checkPublicSuffix('www.www.ck', 'www.ck')
|
78
|
-
# US K12.
|
79
|
-
checkPublicSuffix('us', 'NULL')
|
80
|
-
checkPublicSuffix('test.us', 'test.us')
|
81
|
-
checkPublicSuffix('www.test.us', 'test.us')
|
82
|
-
checkPublicSuffix('ak.us', 'NULL')
|
83
|
-
checkPublicSuffix('test.ak.us', 'test.ak.us')
|
84
|
-
checkPublicSuffix('www.test.ak.us', 'test.ak.us')
|
85
|
-
checkPublicSuffix('k12.ak.us', 'NULL')
|
86
|
-
checkPublicSuffix('test.k12.ak.us', 'test.k12.ak.us')
|
87
|
-
checkPublicSuffix('www.test.k12.ak.us', 'test.k12.ak.us')
|
88
|
-
# IDN labels.
|
89
|
-
checkPublicSuffix('食狮.com.cn', '食狮.com.cn')
|
90
|
-
checkPublicSuffix('食狮.公司.cn', '食狮.公司.cn')
|
91
|
-
checkPublicSuffix('www.食狮.公司.cn', '食狮.公司.cn')
|
92
|
-
checkPublicSuffix('shishi.公司.cn', 'shishi.公司.cn')
|
93
|
-
checkPublicSuffix('公司.cn', 'NULL')
|
94
|
-
checkPublicSuffix('食狮.中国', '食狮.中国')
|
95
|
-
checkPublicSuffix('www.食狮.中国', '食狮.中国')
|
96
|
-
checkPublicSuffix('shishi.中国', 'shishi.中国')
|
97
|
-
checkPublicSuffix('中国', 'NULL')
|
98
|
-
# Same as above, but punycoded.
|
99
|
-
# checkPublicSuffix('xn--85x722f.com.cn', 'xn--85x722f.com.cn')
|
100
|
-
# checkPublicSuffix('xn--85x722f.xn--55qx5d.cn', 'xn--85x722f.xn--55qx5d.cn')
|
101
|
-
# checkPublicSuffix('www.xn--85x722f.xn--55qx5d.cn', 'xn--85x722f.xn--55qx5d.cn')
|
102
|
-
# checkPublicSuffix('shishi.xn--55qx5d.cn', 'shishi.xn--55qx5d.cn')
|
103
|
-
# checkPublicSuffix('xn--55qx5d.cn', 'NULL')
|
104
|
-
# checkPublicSuffix('xn--85x722f.xn--fiqs8s', 'xn--85x722f.xn--fiqs8s')
|
105
|
-
# checkPublicSuffix('www.xn--85x722f.xn--fiqs8s', 'xn--85x722f.xn--fiqs8s')
|
106
|
-
# checkPublicSuffix('shishi.xn--fiqs8s', 'shishi.xn--fiqs8s')
|
107
|
-
# checkPublicSuffix('xn--fiqs8s', 'NULL')
|