Skip to content

Commit

Permalink
With some .ch domains, whois.nic.ch parser returns invalid or duplica…
Browse files Browse the repository at this point in the history
…te values for nameservers.
  • Loading branch information
weppos committed Mar 24, 2010
1 parent 8c89658 commit ad132a6
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.rdoc
Expand Up @@ -5,6 +5,8 @@

* ADDED: Added simple .nz TLD parser (whois.srs.net.nz).

* FIXED: With some .ch domains, whois.nic.ch parser returns invalid or duplicate values for nameservers.


== Release 1.0.7

Expand Down
8 changes: 7 additions & 1 deletion lib/whois/answer/parser/whois.nic.ch.rb
Expand Up @@ -58,9 +58,15 @@ class WhoisNicCh < Base
property_not_supported :expires_on


# Nameservers are listed in the following formats:
#
# Nserver: ns1.prodns.de 213.160.64.75
# Nserver: ns1.prodns.de
#
# In both cases, always return only the name.
property_supported :nameservers do
@nameservers ||= if content_for_scanner =~ /Name servers:\n((.+\n)+)(?:\n|\z)/
$1.split("\n")
$1.split("\n").map { |value| value.split("\t").first }.uniq
end
@nameservers ||= []
end
Expand Down
7 changes: 7 additions & 0 deletions test/answer/parser/whois.nic.ch_test.rb
Expand Up @@ -55,4 +55,11 @@ def test_nameservers
assert_equal expected, parser.instance_eval { @nameservers }
end

def test_nameservers_with_ip
parser = @klass.new(load_part('/property_nameservers_with_ip.txt'))
expected = %w( ns1.citrin.ch ns2.citrin.ch )
assert_equal expected, parser.nameservers
assert_equal expected, parser.instance_eval { @nameservers }
end

end
@@ -0,0 +1,27 @@
whois: This information is subject to an Acceptable Use Policy.
See http://www.nic.ch/terms/aup.html


Domain name:
pui.ch

Holder of domain name:
Keller Philipp
Schauenbergstrasse 26
CH-8046 Zürich
Switzerland
Contractual Language: German

Technical contact:
Keller Philipp
Schauenbergstrasse 26
CH-8046 Zürich
Switzerland

DNSSEC:N

Name servers:
ns1.citrin.ch [193.247.72.8]
ns1.citrin.ch [2001:8a8:21:5::11]
ns2.citrin.ch [2001:8a8:21:5::12]
ns2.citrin.ch [62.12.149.3]

0 comments on commit ad132a6

Please sign in to comment.