public_suffix 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,4 +1,11 @@
1
+ # Bundler
1
2
  .bundle
2
- .yardoc
3
+ Gemfile.lock
3
4
  pkg/*
4
- yardoc
5
+
6
+ # Rubinius
7
+ *.rbc
8
+
9
+ # YARD
10
+ .yardoc
11
+ yardoc/
@@ -1,11 +1,12 @@
1
+ language: ruby
1
2
  rvm:
2
3
  - 1.8.7
3
4
  - 1.9.2
4
- - ruby-head
5
+ - 1.9.3
6
+ - jruby-18mode
7
+ - jruby-19mode
8
+ - rbx-18mode
5
9
  - ree
6
- - jruby
7
- - rbx
8
- - rbx-2.0
9
10
  notifications:
10
11
  recipients:
11
12
  - weppos@weppos.net
@@ -1,9 +1,18 @@
1
1
  # Changelog
2
2
 
3
3
 
4
+ ## Release 1.1.0
5
+
6
+ - FIXED: #valid? and #parse consider URIs as valid domains (GH-15)
7
+
8
+ - CHANGED: Updated definitions.
9
+
10
+ - CHANGED: Removed deprecatd PublicSuffixService::RuleList.
11
+
12
+
4
13
  ## Release 1.0.0
5
14
 
6
- * CHANGED: Updated definitions.
15
+ - CHANGED: Updated definitions.
7
16
 
8
17
 
9
18
  ## Release 1.0.0.rc1
@@ -13,127 +22,127 @@ The library is now known as PublicSuffix.
13
22
 
14
23
  ## Release 0.9.1
15
24
 
16
- * CHANGED: Renamed PublicSuffixService::RuleList to PublicSuffixService::List.
25
+ - CHANGED: Renamed PublicSuffixService::RuleList to PublicSuffixService::List.
17
26
 
18
- * CHANGED: Renamed PublicSuffixService::List#list to PublicSuffixService::List#rules.
27
+ - CHANGED: Renamed PublicSuffixService::List#list to PublicSuffixService::List#rules.
19
28
 
20
- * CHANGED: Renamed PublicSuffixService to PublicSuffix.
29
+ - CHANGED: Renamed PublicSuffixService to PublicSuffix.
21
30
 
22
- * CHANGED: Updated definitions.
31
+ - CHANGED: Updated definitions.
23
32
 
24
33
 
25
34
  ## Release 0.9.0
26
35
 
27
- * CHANGED: Minimum Ruby version increased to Ruby 1.8.7.
36
+ - CHANGED: Minimum Ruby version increased to Ruby 1.8.7.
28
37
 
29
- * CHANGED: rake/gempackagetask is deprecated. Use rubygems/package_task instead.
38
+ - CHANGED: rake/gempackagetask is deprecated. Use rubygems/package_task instead.
30
39
 
31
40
 
32
41
  ## Release 0.8.4
33
42
 
34
- * FIXED: Reverted bugfix for issue #12 for Ruby 1.8.6.
43
+ - FIXED: Reverted bugfix for issue #12 for Ruby 1.8.6.
35
44
  This is the latest version compatible with Ruby 1.8.6.
36
45
 
37
46
 
38
47
  ## Release 0.8.3
39
48
 
40
- * FIXED: Fixed ArgumentError: invalid byte sequence in US-ASCII with Ruby 1.9.2 (#12).
49
+ - FIXED: Fixed ArgumentError: invalid byte sequence in US-ASCII with Ruby 1.9.2 (#12).
41
50
 
42
- * CHANGED: Updated definitions (#11).
51
+ - CHANGED: Updated definitions (#11).
43
52
 
44
- * CHANGED: Renamed definitions.txt to definitions.dat.
53
+ - CHANGED: Renamed definitions.txt to definitions.dat.
45
54
 
46
55
 
47
56
  ## Release 0.8.2
48
57
 
49
- * NEW: Added support for rubygems-test.
58
+ - NEW: Added support for rubygems-test.
50
59
 
51
- * CHANGED: Integrated Bundler.
60
+ - CHANGED: Integrated Bundler.
52
61
 
53
- * CHANGED: Updated definitions.
62
+ - CHANGED: Updated definitions.
54
63
 
55
64
 
56
65
  ## Release 0.8.1
57
66
 
58
- * FIXED: The files in the release 0.8.0 have wrong permission 600 and can't be loaded (#10).
67
+ - FIXED: The files in the release 0.8.0 have wrong permission 600 and can't be loaded (#10).
59
68
 
60
69
 
61
70
  ## Release 0.8.0
62
71
 
63
- * CHANGED: Update public suffix list to d1a5599b49fa 2010-10-25 15:10 +0100 (#9)
72
+ - CHANGED: Update public suffix list to d1a5599b49fa 2010-10-25 15:10 +0100 (#9)
64
73
 
65
- * NEW: Add support for Fully Qualified Domain Names (#7)
74
+ - NEW: Add support for Fully Qualified Domain Names (#7)
66
75
 
67
76
 
68
77
  ## Release 0.7.0
69
78
 
70
- * CHANGED: Using YARD to document the code instead of RDoc.
79
+ - CHANGED: Using YARD to document the code instead of RDoc.
71
80
 
72
- * FIXED: RuleList cache is not recreated when a new rule is appended to the list (#6)
81
+ - FIXED: RuleList cache is not recreated when a new rule is appended to the list (#6)
73
82
 
74
- * FIXED: PublicSuffixService.valid? should return false if the domain is not defined or not allowed (#4, #5)
83
+ - FIXED: PublicSuffixService.valid? should return false if the domain is not defined or not allowed (#4, #5)
75
84
 
76
85
 
77
86
  ## Release 0.6.0
78
87
 
79
- * NEW: PublicSuffixService.parse raises DomainNotAllowed when trying to parse a domain name
88
+ - NEW: PublicSuffixService.parse raises DomainNotAllowed when trying to parse a domain name
80
89
  which exists, but is not allowed by the current definition list (#3)
81
90
 
82
91
  PublicSuffixService.parse("nic.do")
83
92
  # => PublicSuffixService::DomainNotAllowed
84
93
 
85
- * CHANGED: Renamed PublicSuffixService::InvalidDomain to PublicSuffixService::DomainInvalid
94
+ - CHANGED: Renamed PublicSuffixService::InvalidDomain to PublicSuffixService::DomainInvalid
86
95
 
87
96
 
88
97
  ## Release 0.5.2
89
98
 
90
- * CHANGED: Update public suffix list to 248ea690d671 2010-09-16 18:02 +0100
99
+ - CHANGED: Update public suffix list to 248ea690d671 2010-09-16 18:02 +0100
91
100
 
92
101
 
93
102
  ## Release 0.5.1
94
103
 
95
- * CHANGED: Update public suffix list to 14dc66dd53c1 2010-09-15 17:09 +0100
104
+ - CHANGED: Update public suffix list to 14dc66dd53c1 2010-09-15 17:09 +0100
96
105
 
97
106
 
98
107
  ## Release 0.5.0
99
108
 
100
- * CHANGED: Improve documentation for Domain#domain and Domain#subdomain (#1).
109
+ - CHANGED: Improve documentation for Domain#domain and Domain#subdomain (#1).
101
110
 
102
- * CHANGED: Performance improvements (#2).
111
+ - CHANGED: Performance improvements (#2).
103
112
 
104
113
 
105
114
  ## Release 0.4.0
106
115
 
107
- * CHANGED: Rename library from DomainName to PublicSuffixService to reduce the probability of name conflicts.
116
+ - CHANGED: Rename library from DomainName to PublicSuffixService to reduce the probability of name conflicts.
108
117
 
109
118
 
110
119
  ## Release 0.3.1
111
120
 
112
- * Deprecated DomainName library.
121
+ - Deprecated DomainName library.
113
122
 
114
123
 
115
124
  ## Release 0.3.0
116
125
 
117
- * CHANGED: DomainName#domain and DomainName#subdomain are no longer alias of Domain#sld and Domain#tld.
126
+ - CHANGED: DomainName#domain and DomainName#subdomain are no longer alias of Domain#sld and Domain#tld.
118
127
 
119
- * CHANGED: Removed DomainName#labels and decoupled Rule from DomainName.
128
+ - CHANGED: Removed DomainName#labels and decoupled Rule from DomainName.
120
129
 
121
- * CHANGED: DomainName#valid? no longer instantiates new DomainName objects. This means less overhead.
130
+ - CHANGED: DomainName#valid? no longer instantiates new DomainName objects. This means less overhead.
122
131
 
123
- * CHANGED: Refactoring the entire DomainName API. Removed the internal on-the-fly parsing. Added a bunch of new methods to check and validate the DomainName.
132
+ - CHANGED: Refactoring the entire DomainName API. Removed the internal on-the-fly parsing. Added a bunch of new methods to check and validate the DomainName.
124
133
 
125
134
 
126
135
  ## Release 0.2.0
127
136
 
128
- * NEW: DomainName#valid?
137
+ - NEW: DomainName#valid?
129
138
 
130
- * NEW: DomainName#parse and DomainName#parse!
139
+ - NEW: DomainName#parse and DomainName#parse!
131
140
 
132
- * NEW: DomainName#valid_domain? and DomainName#valid_subdomain?
141
+ - NEW: DomainName#valid_domain? and DomainName#valid_subdomain?
133
142
 
134
- * CHANGED: Make sure RuleList lookup is only performed once.
143
+ - CHANGED: Make sure RuleList lookup is only performed once.
135
144
 
136
145
 
137
146
  ## Release 0.1.0
138
147
 
139
- * Initial version
148
+ - Initial version
data/Gemfile CHANGED
@@ -1,4 +1,3 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- # Specify your gem's dependencies in whois.gemspec
4
3
  gemspec
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
- Copyright (c) 2009-2011 Simone Carletti <weppos@weppos.net>
1
+ The MIT License
2
2
 
3
- MIT License
3
+ Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -41,12 +41,12 @@ For older versions of Ruby, see the CHANGELOG.md file.
41
41
 
42
42
  Successfully tested against the following interpreters:
43
43
 
44
- * "Ruby":http://www.ruby-lang.org/ 1.8.x MRI
45
- * "Ruby":http://www.ruby-lang.org/ 1.9.x MRI
46
- * "Ruby Enterprise Edition":http://www.rubyenterpriseedition.com/
47
- * "JRuby":http://jruby.org/
48
- * "Rubinius":http://rubini.us/
49
- * "MacRuby":http://www.macruby.org/
44
+ * [Ruby](http://www.ruby-lang.org/) 1.8.x MRI
45
+ * [Ruby](http://www.ruby-lang.org/) 1.9.x MRI
46
+ * [Ruby Enterprise Edition](http://www.rubyenterpriseedition.com/)
47
+ * [JRuby](http://jruby.org/)
48
+ * [Rubinius](http://rubini.us/)
49
+ * [MacRuby](http://www.macruby.org/)
50
50
 
51
51
 
52
52
  ## Installation
@@ -88,7 +88,7 @@ Example domain with subdomains.
88
88
  domain.domain
89
89
  # => "google.com"
90
90
  domain.subdomain
91
- # => "google.com"
91
+ # => "www.google.com"
92
92
 
93
93
  Simple validation example.
94
94
 
@@ -120,10 +120,10 @@ This library automatically recognizes Fully Qualified Domain Names. A FQDN is a
120
120
 
121
121
  ## Credits
122
122
 
123
- * **Author:** [Simone Carletti](http://www.simonecarletti.com/)
123
+ * [Simone Carletti](http://www.simonecarletti.com/) <weppos@weppos.net> - The Author
124
124
 
125
125
 
126
- ## FeedBack and Bug reports
126
+ ## Feedback and bug reports
127
127
 
128
128
  If you use this library and find yourself missing any functionality, please [let me know](mailto:weppos@weppos.net).
129
129
 
@@ -147,5 +147,6 @@ See the CHANGELOG.md file for details.
147
147
 
148
148
  ## License
149
149
 
150
- *Public Suffix* is copyright (c) 2009-2011 Simone Carletti.
150
+ Copyright (c) 2009-2012 Simone Carletti.
151
+
151
152
  This is Free Software distributed under the MIT license.
data/Rakefile CHANGED
@@ -1,7 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'rubygems/package_task'
3
3
  require 'bundler'
4
- require 'rake/testtask'
5
4
 
6
5
  $:.unshift(File.dirname(__FILE__) + "/lib")
7
6
  require 'public_suffix'
@@ -10,7 +9,6 @@ require 'public_suffix'
10
9
  # Common package properties
11
10
  PKG_NAME = ENV['PKG_NAME'] || PublicSuffix::GEM
12
11
  PKG_VERSION = ENV['PKG_VERSION'] || PublicSuffix::VERSION
13
- RUBYFORGE_PROJECT = nil
14
12
 
15
13
 
16
14
  # Run test by default.
@@ -29,17 +27,18 @@ spec = Gem::Specification.new do |s|
29
27
  s.email = "weppos@weppos.net"
30
28
  s.homepage = "http://www.simonecarletti.com/code/public_suffix"
31
29
 
32
- # Add any extra files to include in the gem (like your README)
33
30
  s.files = `git ls-files`.split("\n")
34
31
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
35
32
  s.require_paths = %w( lib )
36
33
 
37
- # If your tests use any gems, include them here
38
34
  s.add_development_dependency("rake")
39
35
  s.add_development_dependency("mocha")
40
36
  s.add_development_dependency("yard")
41
37
  end
42
38
 
39
+
40
+ require 'rubygems/package_task'
41
+
43
42
  Gem::PackageTask.new(spec) do |pkg|
44
43
  pkg.gem_spec = spec
45
44
  end
@@ -62,7 +61,8 @@ desc "Package the library and generates the gemspec"
62
61
  task :package => [:gemspec]
63
62
 
64
63
 
65
- # Run all the tests in the /test folder
64
+ require 'rake/testtask'
65
+
66
66
  Rake::TestTask.new do |t|
67
67
  t.libs << "test"
68
68
  t.test_files = FileList["test/**/*_test.rb"]
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # Domain name parser based on the Public Suffix List.
5
5
  #
6
- # Copyright (c) 2009-2011 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -21,10 +21,6 @@ module PublicSuffix
21
21
  AUTHORS = ["Simone Carletti <weppos@weppos.net>"]
22
22
 
23
23
 
24
- # Backwards compatibility
25
- autoload :RuleList, 'public_suffix/rule_list'
26
-
27
-
28
24
  # Parses +domain+ and returns the
29
25
  # {PublicSuffix::Domain} instance.
30
26
  #
@@ -67,6 +63,7 @@ module PublicSuffix
67
63
  #
68
64
  def self.parse(domain)
69
65
  rule = List.default.find(domain)
66
+
70
67
  if rule.nil?
71
68
  raise DomainInvalid, "`#{domain}' is not a valid domain"
72
69
  end
@@ -40,6 +40,8 @@
40
40
  //
41
41
  // ***** END LICENSE BLOCK *****
42
42
 
43
+ // ===BEGIN ICANN DOMAINS===
44
+
43
45
  // ac : http://en.wikipedia.org/wiki/.ac
44
46
  ac
45
47
  com.ac
@@ -236,7 +238,7 @@ urn.arpa
236
238
  as
237
239
  gov.as
238
240
 
239
- // asia: http://en.wikipedia.org/wiki/.asia
241
+ // asia : http://en.wikipedia.org/wiki/.asia
240
242
  asia
241
243
 
242
244
  // at : http://en.wikipedia.org/wiki/.at
@@ -247,17 +249,31 @@ co.at
247
249
  gv.at
248
250
  or.at
249
251
 
250
- // http://www.info.at/
251
- biz.at
252
- info.at
253
-
254
- // priv.at : http://www.nic.priv.at/
255
- // Submitted by registry <lendl@nic.at> 2008-06-09
256
- priv.at
257
-
258
252
  // au : http://en.wikipedia.org/wiki/.au
259
- *.au
260
- // au geographical names (vic.au etc... are covered above)
253
+ // http://www.auda.org.au/
254
+ // 2LDs
255
+ com.au
256
+ net.au
257
+ org.au
258
+ edu.au
259
+ gov.au
260
+ csiro.au
261
+ asn.au
262
+ id.au
263
+ // Historic 2LDs (closed to new registration, but sites still exist)
264
+ info.au
265
+ conf.au
266
+ oz.au
267
+ // CGDNs - http://www.cgdn.org.au/
268
+ act.au
269
+ nsw.au
270
+ nt.au
271
+ qld.au
272
+ sa.au
273
+ tas.au
274
+ vic.au
275
+ wa.au
276
+ // 3LDs
261
277
  act.edu.au
262
278
  nsw.edu.au
263
279
  nt.edu.au
@@ -275,15 +291,6 @@ sa.gov.au
275
291
  tas.gov.au
276
292
  vic.gov.au
277
293
  wa.gov.au
278
- // CGDNs - http://www.aucd.org.au/
279
- act.au
280
- nsw.au
281
- nt.au
282
- qld.au
283
- sa.au
284
- tas.au
285
- vic.au
286
- wa.au
287
294
 
288
295
  // aw : http://en.wikipedia.org/wiki/.aw
289
296
  aw
@@ -615,11 +622,14 @@ gouv.ci
615
622
 
616
623
  // ck : http://en.wikipedia.org/wiki/.ck
617
624
  *.ck
625
+ !www.ck
618
626
 
619
627
  // cl : http://en.wikipedia.org/wiki/.cl
620
628
  cl
621
629
  gov.cl
622
630
  gob.cl
631
+ co.cl
632
+ mil.cl
623
633
 
624
634
  // cm : http://en.wikipedia.org/wiki/.cm
625
635
  cm
@@ -694,35 +704,6 @@ web.co
694
704
  // com : http://en.wikipedia.org/wiki/.com
695
705
  com
696
706
 
697
- // CentralNic names : http://www.centralnic.com/names/domains
698
- // Confirmed by registry <gavin.brown@centralnic.com> 2008-06-09
699
- // Updated by registry <gavin.brown@centralnic.com> 2011-05-27
700
- ar.com
701
- br.com
702
- cn.com
703
- de.com
704
- eu.com
705
- gb.com
706
- gr.com
707
- hu.com
708
- jpn.com
709
- kr.com
710
- no.com
711
- qc.com
712
- ru.com
713
- sa.com
714
- se.com
715
- uk.com
716
- us.com
717
- uy.com
718
- za.com
719
-
720
- // Requested by Yngve Pettersen <yngve@opera.com> 2009-11-26
721
- operaunite.com
722
-
723
- // Requested by Eduardo Vela <evn@google.com> 2010-09-06
724
- appspot.com
725
-
726
707
  // coop : http://en.wikipedia.org/wiki/.coop
727
708
  coop
728
709
 
@@ -764,10 +745,6 @@ cz
764
745
  // reservations) 2008-07-01
765
746
  de
766
747
 
767
- // CentralNic names : http://www.centralnic.com/names/domains
768
- // Submitted by registry <gavin.brown@centralnic.com> 2011-05-27
769
- com.de
770
-
771
748
  // dj : http://en.wikipedia.org/wiki/.dj
772
749
  dj
773
750
 
@@ -876,8 +853,6 @@ fi
876
853
  // completely removed.
877
854
  // TODO: Check for updates (expected to be phased out around Q1/2009)
878
855
  aland.fi
879
- // iki.fi : Submitted by Hannu Aronsson <haa@iki.fi> 2009-11-05
880
- iki.fi
881
856
 
882
857
  // fj : http://en.wikipedia.org/wiki/.fj
883
858
  *.fj
@@ -1014,6 +989,7 @@ gs
1014
989
 
1015
990
  // gt : http://www.gt/politicas.html
1016
991
  *.gt
992
+ !www.gt
1017
993
 
1018
994
  // gu : http://gadao.gov.gu/registration.txt
1019
995
  *.gu
@@ -1799,8 +1775,6 @@ gov.la
1799
1775
  per.la
1800
1776
  com.la
1801
1777
  org.la
1802
- // see http://www.c.la/
1803
- c.la
1804
1778
 
1805
1779
  // lb : http://en.wikipedia.org/wiki/.lb
1806
1780
  // Submitted by registry <randy@psg.com> 2008-06-17
@@ -1840,9 +1814,6 @@ assn.lk
1840
1814
  grp.lk
1841
1815
  hotel.lk
1842
1816
 
1843
- // local : http://en.wikipedia.org/wiki/.local
1844
- local
1845
-
1846
1817
  // lr : http://psg.com/dns/lr/lr.txt
1847
1818
  // Submitted by registry <randy@psg.com> 2008-06-17
1848
1819
  com.lr
@@ -2643,16 +2614,6 @@ ne
2643
2614
  // net : http://en.wikipedia.org/wiki/.net
2644
2615
  net
2645
2616
 
2646
- // CentralNic names : http://www.centralnic.com/names/domains
2647
- // Submitted by registry <gavin.brown@centralnic.com> 2008-06-17
2648
- gb.net
2649
- se.net
2650
- uk.net
2651
-
2652
- // ZaNiC names : http://www.za.net/
2653
- // Confirmed by registry <hostmaster@nic.za.net> 2009-10-03
2654
- za.net
2655
-
2656
2617
  // nf : http://en.wikipedia.org/wiki/.nf
2657
2618
  nf
2658
2619
  com.nf
@@ -2686,9 +2647,6 @@ nl
2686
2647
  // BV.nl will be a registry for dutch BV's (besloten vennootschap)
2687
2648
  bv.nl
2688
2649
 
2689
- // the co.nl domain is managed by CoDNS B.V. Added 2010-05-23.
2690
- co.nl
2691
-
2692
2650
  // no : http://www.norid.no/regelverk/index.en.html
2693
2651
  // The Norwegian registry has declined to notify us of updates. The web pages
2694
2652
  // referenced below are the official source of the data. There is also an
@@ -3456,9 +3414,6 @@ våler.østfold.no
3456
3414
  valer.hedmark.no
3457
3415
  våler.hedmark.no
3458
3416
 
3459
- // the co.no domain is managed by CoDNS B.V. Added 2010-05-23.
3460
- co.no
3461
-
3462
3417
  // np : http://www.mos.com.np/register.html
3463
3418
  *.np
3464
3419
 
@@ -3495,16 +3450,6 @@ nu
3495
3450
  // org : http://en.wikipedia.org/wiki/.org
3496
3451
  org
3497
3452
 
3498
- // CentralNic names : http://www.centralnic.com/names/domains
3499
- // Submitted by registry <gavin.brown@centralnic.com> 2008-06-17
3500
- // Updated by registry <gavin.brown@centralnic.com> 2011-05-27
3501
- ae.org
3502
- us.org
3503
-
3504
- // ZaNiC names : http://www.za.net/
3505
- // Confirmed by registry <hostmaster@nic.za.net> 2009-10-03
3506
- za.org
3507
-
3508
3453
  // pa : http://www.nic.pa/
3509
3454
  // Some additional second level "domains" resolve directly as hostnames, such as
3510
3455
  // pannet.pa, so we add a rule for "pa".
@@ -3758,9 +3703,6 @@ poznan.pl
3758
3703
  wroc.pl
3759
3704
  zakopane.pl
3760
3705
 
3761
- // co.pl : Mainseek Sp. z o.o. http://www.co.pl
3762
- co.pl
3763
-
3764
3706
  // pn : http://www.government.pn/PnRegistry/policies.htm
3765
3707
  pn
3766
3708
  gov.pn
@@ -3830,8 +3772,16 @@ belau.pw
3830
3772
  // py : http://www.nic.py/faq_a.html#faq_b
3831
3773
  *.py
3832
3774
 
3833
- // qa : http://www.qatar.net.qa/services/virtual.htm
3834
- *.qa
3775
+ // qa : http://domains.qa/en/
3776
+ qa
3777
+ com.qa
3778
+ edu.qa
3779
+ gov.qa
3780
+ mil.qa
3781
+ name.qa
3782
+ net.qa
3783
+ org.qa
3784
+ sch.qa
3835
3785
 
3836
3786
  // re : http://www.afnic.re/obtenir/chartes/nommage-re/annexe-descriptifs
3837
3787
  re
@@ -4400,6 +4350,10 @@ zp.ua
4400
4350
  zhitomir.ua
4401
4351
  zt.ua
4402
4352
 
4353
+ // Private registries in .ua
4354
+ co.ua
4355
+ pp.ua
4356
+
4403
4357
  // ug : http://www.registry.co.ug/
4404
4358
  ug
4405
4359
  co.ug
@@ -4903,9 +4857,6 @@ xxx
4903
4857
  // ye : http://www.y.net.ye/services/domain_name.htm
4904
4858
  *.ye
4905
4859
 
4906
- // yu : http://www.nic.yu/pravilnik-e.html
4907
- *.yu
4908
-
4909
4860
  // za : http://www.zadna.org.za/slds.html
4910
4861
  *.za
4911
4862
 
@@ -4915,7 +4866,77 @@ xxx
4915
4866
  // zw : http://en.wikipedia.org/wiki/.zw
4916
4867
  *.zw
4917
4868
 
4918
- // DynDNS.com Dynamic DNS zones : http://www.dyndns.com/services/dns/dyndns/
4869
+ // ===END ICANN DOMAINS===
4870
+ // ===BEGIN PRIVATE DOMAINS===
4871
+
4872
+ // info.at : http://www.info.at/
4873
+ biz.at
4874
+ info.at
4875
+
4876
+ // priv.at : http://www.nic.priv.at/
4877
+ // Submitted by registry <lendl@nic.at> 2008-06-09
4878
+ priv.at
4879
+
4880
+ // co.ca : http://registry.co.ca
4881
+ co.ca
4882
+
4883
+ // CentralNic : http://www.centralnic.com/names/domains
4884
+ // Confirmed by registry <gavin.brown@centralnic.com> 2008-06-09
4885
+ ar.com
4886
+ br.com
4887
+ cn.com
4888
+ de.com
4889
+ eu.com
4890
+ gb.com
4891
+ gr.com
4892
+ hu.com
4893
+ jpn.com
4894
+ kr.com
4895
+ no.com
4896
+ qc.com
4897
+ ru.com
4898
+ sa.com
4899
+ se.com
4900
+ uk.com
4901
+ us.com
4902
+ uy.com
4903
+ za.com
4904
+ gb.net
4905
+ jp.net
4906
+ se.net
4907
+ uk.net
4908
+ ae.org
4909
+ us.org
4910
+ com.de
4911
+
4912
+ // Opera Software, A.S.A.
4913
+ // Requested by Yngve Pettersen <yngve@opera.com> 2009-11-26
4914
+ operaunite.com
4915
+
4916
+ // Google, Inc.
4917
+ // Requested by Eduardo Vela <evn@google.com> 2010-09-06
4918
+ appspot.com
4919
+
4920
+ // iki.fi : Submitted by Hannu Aronsson <haa@iki.fi> 2009-11-05
4921
+ iki.fi
4922
+
4923
+ // c.la : http://www.c.la/
4924
+ c.la
4925
+
4926
+ // ZaNiC : http://www.za.net/
4927
+ // Confirmed by registry <hostmaster@nic.za.net> 2009-10-03
4928
+ za.net
4929
+ za.org
4930
+
4931
+ // CoDNS B.V.
4932
+ // Added 2010-05-23.
4933
+ co.nl
4934
+ co.no
4935
+
4936
+ // Mainseek Sp. z o.o. : http://www.co.pl/
4937
+ co.pl
4938
+
4939
+ // DynDNS.com : http://www.dyndns.com/services/dns/dyndns/
4919
4940
  dyndns-at-home.com
4920
4941
  dyndns-at-work.com
4921
4942
  dyndns-blog.com
@@ -5195,3 +5216,5 @@ webhop.net
5195
5216
  webhop.org
5196
5217
  worse-than.tv
5197
5218
  writesthisblog.com
5219
+
5220
+ // ===END PRIVATE DOMAINS===
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # Domain name parser based on the Public Suffix List.
5
5
  #
6
- # Copyright (c) 2009-2011 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # Domain name parser based on the Public Suffix List.
5
5
  #
6
- # Copyright (c) 2009-2011 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # Domain name parser based on the Public Suffix List.
5
5
  #
6
- # Copyright (c) 2009-2011 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -195,6 +195,9 @@ module PublicSuffix
195
195
  #
196
196
  # @return [Array<PublicSuffix::Rule::*>]
197
197
  def select(domain)
198
+ # raise DomainInvalid, "`#{domain}' is not expected to contain a scheme"
199
+ return [] if domain.include?("://")
200
+
198
201
  indices = (@indexes[Domain.domain_to_labels(domain).first] || [])
199
202
  @rules.values_at(*indices).select { |rule| rule.match?(domain) }
200
203
  end
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # Domain name parser based on the Public Suffix List.
5
5
  #
6
- # Copyright (c) 2009-2011 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # Domain name parser based on the Public Suffix List.
5
5
  #
6
- # Copyright (c) 2009-2011 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -11,7 +11,7 @@ module PublicSuffix
11
11
 
12
12
  module Version
13
13
  MAJOR = 1
14
- MINOR = 0
14
+ MINOR = 1
15
15
  PATCH = 0
16
16
  BUILD = nil
17
17
 
@@ -2,18 +2,18 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "public_suffix"
5
- s.version = "1.0.0"
5
+ s.version = "1.1.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Simone Carletti"]
9
- s.date = "2011-12-24"
9
+ s.date = "2012-03-16"
10
10
  s.description = "PublicSuffix can parse and decompose a domain name into top level domain, domain and subdomains."
11
11
  s.email = "weppos@weppos.net"
12
- s.files = [".gemtest", ".gitignore", ".travis.yml", ".yardopts", "CHANGELOG.md", "Gemfile", "Gemfile.lock", "LICENSE", "README.md", "Rakefile", "lib/public_suffix.rb", "lib/public_suffix/definitions.txt", "lib/public_suffix/domain.rb", "lib/public_suffix/errors.rb", "lib/public_suffix/list.rb", "lib/public_suffix/rule.rb", "lib/public_suffix/rule_list.rb", "lib/public_suffix/version.rb", "public_suffix.gemspec", "test/acceptance_test.rb", "test/test_helper.rb", "test/unit/domain_test.rb", "test/unit/errors_test.rb", "test/unit/list_test.rb", "test/unit/public_suffix_test.rb", "test/unit/rule_test.rb"]
12
+ s.files = [".gemtest", ".gitignore", ".travis.yml", ".yardopts", "CHANGELOG.md", "Gemfile", "LICENSE", "README.md", "Rakefile", "lib/public_suffix.rb", "lib/public_suffix/definitions.txt", "lib/public_suffix/domain.rb", "lib/public_suffix/errors.rb", "lib/public_suffix/list.rb", "lib/public_suffix/rule.rb", "lib/public_suffix/version.rb", "public_suffix.gemspec", "test/acceptance_test.rb", "test/test_helper.rb", "test/unit/domain_test.rb", "test/unit/errors_test.rb", "test/unit/list_test.rb", "test/unit/public_suffix_test.rb", "test/unit/rule_test.rb"]
13
13
  s.homepage = "http://www.simonecarletti.com/code/public_suffix"
14
14
  s.require_paths = ["lib"]
15
15
  s.required_ruby_version = Gem::Requirement.new(">= 1.8.7")
16
- s.rubygems_version = "1.8.11"
16
+ s.rubygems_version = "1.8.15"
17
17
  s.summary = "Domain name parser based in the Public Suffix List."
18
18
  s.test_files = ["test/acceptance_test.rb", "test/test_helper.rb", "test/unit/domain_test.rb", "test/unit/errors_test.rb", "test/unit/list_test.rb", "test/unit/public_suffix_test.rb", "test/unit/rule_test.rb"]
19
19
 
@@ -20,16 +20,19 @@ class AcceptanceTest < Test::Unit::TestCase
20
20
  assert_equal tld, domain.tld, "Invalid tld for '#{name}'"
21
21
  assert_equal sld, domain.sld, "Invalid sld for '#{name}'"
22
22
  assert_equal trd, domain.trd, "Invalid trd for '#{name}'"
23
+ assert PublicSuffix.valid?(name)
23
24
  end
24
25
  end
25
26
 
26
27
  InvalidCases = {
27
28
  "nic.ke" => PublicSuffix::DomainNotAllowed,
29
+ "http://www.google.com" => PublicSuffix::DomainInvalid,
28
30
  }
29
31
 
30
32
  def test_invalid
31
33
  InvalidCases.each do |name, error|
32
34
  assert_raise(error) { PublicSuffix.parse(name) }
35
+ assert !PublicSuffix.valid?(name)
33
36
  end
34
37
  end
35
38
 
@@ -21,21 +21,10 @@ class PublicSuffix::ListTest < Test::Unit::TestCase
21
21
  end
22
22
 
23
23
  def test_indexes
24
- @list = PublicSuffix::List.parse(<<EOS)
25
- // com : http://en.wikipedia.org/wiki/.com
26
- com
27
-
28
- // uk : http://en.wikipedia.org/wiki/.uk
29
- *.uk
30
- *.sch.uk
31
- !bl.uk
32
- !british-library.uk
33
- EOS
34
-
35
- assert !@list.indexes.empty?
36
- assert_equal [1,2,3,4], @list.indexes.delete('uk')
37
- assert_equal [0], @list.indexes.delete('com')
38
- assert @list.indexes.empty?
24
+ assert !list.indexes.empty?
25
+ assert_equal [1,2,3,4], list.indexes.delete('uk')
26
+ assert_equal [0], list.indexes.delete('com')
27
+ assert list.indexes.empty?
39
28
  end
40
29
 
41
30
 
@@ -88,37 +77,22 @@ EOS
88
77
 
89
78
 
90
79
  def test_find
91
- @list = PublicSuffix::List.parse(<<EOS)
92
- // com : http://en.wikipedia.org/wiki/.com
93
- com
94
-
95
- // uk : http://en.wikipedia.org/wiki/.uk
96
- *.uk
97
- *.sch.uk
98
- !bl.uk
99
- !british-library.uk
100
- EOS
101
- assert_equal PublicSuffix::Rule.factory("com"), @list.find("google.com")
102
- assert_equal PublicSuffix::Rule.factory("com"), @list.find("foo.google.com")
103
- assert_equal PublicSuffix::Rule.factory("*.uk"), @list.find("google.uk")
104
- assert_equal PublicSuffix::Rule.factory("*.uk"), @list.find("google.co.uk")
105
- assert_equal PublicSuffix::Rule.factory("*.uk"), @list.find("foo.google.co.uk")
106
- assert_equal PublicSuffix::Rule.factory("!british-library.uk"), @list.find("british-library.uk")
107
- assert_equal PublicSuffix::Rule.factory("!british-library.uk"), @list.find("foo.british-library.uk")
80
+ assert_equal PublicSuffix::Rule.factory("com"), list.find("google.com")
81
+ assert_equal PublicSuffix::Rule.factory("com"), list.find("foo.google.com")
82
+ assert_equal PublicSuffix::Rule.factory("*.uk"), list.find("google.uk")
83
+ assert_equal PublicSuffix::Rule.factory("*.uk"), list.find("google.co.uk")
84
+ assert_equal PublicSuffix::Rule.factory("*.uk"), list.find("foo.google.co.uk")
85
+ assert_equal PublicSuffix::Rule.factory("!british-library.uk"), list.find("british-library.uk")
86
+ assert_equal PublicSuffix::Rule.factory("!british-library.uk"), list.find("foo.british-library.uk")
108
87
  end
109
88
 
110
89
  def test_select
111
- @list = PublicSuffix::List.parse(<<EOS)
112
- // com : http://en.wikipedia.org/wiki/.com
113
- com
90
+ assert_equal 2, list.select("british-library.uk").size
91
+ end
114
92
 
115
- // uk : http://en.wikipedia.org/wiki/.uk
116
- *.uk
117
- *.sch.uk
118
- !bl.uk
119
- !british-library.uk
120
- EOS
121
- assert_equal 2, @list.select("british-library.uk").size
93
+ def test_select_returns_empty_when_domain_has_scheme
94
+ assert_equal [], list.select("http://google.com")
95
+ assert_not_equal [], list.select("google.com")
122
96
  end
123
97
 
124
98
 
@@ -176,7 +150,14 @@ EOS
176
150
  end
177
151
 
178
152
  def test_self_parse_should_create_cache
179
- list = PublicSuffix::List.parse(<<EOS)
153
+ assert_equal PublicSuffix::Rule.factory("com"), list.find("google.com")
154
+ end
155
+
156
+
157
+ private
158
+
159
+ def list
160
+ @_list ||= PublicSuffix::List.parse(<<EOS)
180
161
  // com : http://en.wikipedia.org/wiki/.com
181
162
  com
182
163
 
@@ -186,8 +167,6 @@ com
186
167
  !bl.uk
187
168
  !british-library.uk
188
169
  EOS
189
-
190
- assert_equal PublicSuffix::Rule.factory("com"), list.find("google.com")
191
170
  end
192
171
 
193
172
  end
@@ -52,16 +52,21 @@ class PublicSuffixTest < Test::Unit::TestCase
52
52
  assert_equal "www", domain.trd
53
53
  end
54
54
 
55
- def test_self_parse_should_raise_with_invalid_domain
55
+ def test_self_parse_raises_with_invalid_domain
56
56
  error = assert_raise(PublicSuffix::DomainInvalid) { PublicSuffix.parse("example.zip") }
57
57
  assert_match %r{example\.zip}, error.message
58
58
  end
59
59
 
60
- def test_self_parse_should_raise_with_unallowed_domain
60
+ def test_self_parse_raises_with_unallowed_domain
61
61
  error = assert_raise(PublicSuffix::DomainNotAllowed) { PublicSuffix.parse("example.ke") }
62
62
  assert_match %r{example\.ke}, error.message
63
63
  end
64
64
 
65
+ def test_self_raises_with_uri
66
+ error = assert_raise(PublicSuffix::DomainInvalid) { PublicSuffix.parse("http://google.com") }
67
+ assert_match %r{http://google\.com}, error.message
68
+ end
69
+
65
70
 
66
71
  def test_self_valid
67
72
  assert PublicSuffix.valid?("google.com")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: public_suffix
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-24 00:00:00.000000000Z
12
+ date: 2012-03-16 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &70114624505340 !ruby/object:Gem::Requirement
16
+ requirement: &70155750523420 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70114624505340
24
+ version_requirements: *70155750523420
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: mocha
27
- requirement: &70114624504860 !ruby/object:Gem::Requirement
27
+ requirement: &70155750522400 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70114624504860
35
+ version_requirements: *70155750522400
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: yard
38
- requirement: &70114624504400 !ruby/object:Gem::Requirement
38
+ requirement: &70155750521360 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70114624504400
46
+ version_requirements: *70155750521360
47
47
  description: PublicSuffix can parse and decompose a domain name into top level domain,
48
48
  domain and subdomains.
49
49
  email: weppos@weppos.net
@@ -57,7 +57,6 @@ files:
57
57
  - .yardopts
58
58
  - CHANGELOG.md
59
59
  - Gemfile
60
- - Gemfile.lock
61
60
  - LICENSE
62
61
  - README.md
63
62
  - Rakefile
@@ -67,7 +66,6 @@ files:
67
66
  - lib/public_suffix/errors.rb
68
67
  - lib/public_suffix/list.rb
69
68
  - lib/public_suffix/rule.rb
70
- - lib/public_suffix/rule_list.rb
71
69
  - lib/public_suffix/version.rb
72
70
  - public_suffix.gemspec
73
71
  - test/acceptance_test.rb
@@ -97,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
95
  version: '0'
98
96
  requirements: []
99
97
  rubyforge_project:
100
- rubygems_version: 1.8.11
98
+ rubygems_version: 1.8.15
101
99
  signing_key:
102
100
  specification_version: 3
103
101
  summary: Domain name parser based in the Public Suffix List.
@@ -1,22 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- public_suffix (1.0.0)
5
-
6
- GEM
7
- remote: http://rubygems.org/
8
- specs:
9
- metaclass (0.0.1)
10
- mocha (0.10.0)
11
- metaclass (~> 0.0.1)
12
- rake (0.9.2)
13
- yard (0.7.4)
14
-
15
- PLATFORMS
16
- ruby
17
-
18
- DEPENDENCIES
19
- mocha
20
- public_suffix!
21
- rake
22
- yard
@@ -1,14 +0,0 @@
1
- #--
2
- # Public Suffix
3
- #
4
- # Domain name parser based on the Public Suffix List.
5
- #
6
- # Copyright (c) 2009-2011 Simone Carletti <weppos@weppos.net>
7
- #++
8
-
9
-
10
- warn("The PublicSuffix::RuleList object has been deprecated and will be removed in PublicSuffix 1.1. Please use PublicSuffix::List instead.")
11
-
12
- module PublicSuffix
13
- RuleList = List
14
- end