Skip to content

Commit

Permalink
In case of thin server the client should select the closest whois ser…
Browse files Browse the repository at this point in the history
…ver match (closes #264)
  • Loading branch information
weppos committed Oct 21, 2009
1 parent 686df63 commit 9ff17a7
Show file tree
Hide file tree
Showing 5 changed files with 287 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rdoc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@


* FIXED: Updated the whois.denic.de parser to the new format. Thanks to David Krentzlin (closes #314) * FIXED: Updated the whois.denic.de parser to the new format. Thanks to David Krentzlin (closes #314)


* FIXED: In case of thin server the client should select the closest whois server match (closes #264)

* ADDED: ability to check whether a property is supported via answer.supported? or parser.supported? * ADDED: ability to check whether a property is supported via answer.supported? or parser.supported?




Expand Down
4 changes: 2 additions & 2 deletions lib/whois/server/adapters/verisign.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ def request(qstring)
private private


def extract_referral(response) def extract_referral(response)
if response =~ /Domain Name:/ && response =~ /Whois Server: (\S+)/ if response =~ /Domain Name:/
$1 endpoint = response.scan(/Whois Server: (\S+)/).flatten.last
end end
end end


Expand Down
18 changes: 16 additions & 2 deletions test/server/adapters/verisign_test.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -23,11 +23,25 @@ def test_query_with_referral
response = "Match for DOMAIN.FOO." response = "Match for DOMAIN.FOO."
expected = referral + "\n" + response expected = referral + "\n" + response
@server.expects(:ask_the_socket).with("=domain.foo", "whois.foo", 43).returns(referral) @server.expects(:ask_the_socket).with("=domain.foo", "whois.foo", 43).returns(referral)
@server.expects(:ask_the_socket).with("domain.foo", "whois.tucows.com", 43).returns(response) @server.expects(:ask_the_socket).with("domain.foo", "whois.markmonitor.com", 43).returns(response)
assert_equal expected, assert_equal expected,
@server.query("domain.foo").to_s @server.query("domain.foo").to_s
assert_equal [Whois::Answer::Part.new(referral, "whois.foo"), Whois::Answer::Part.new(response, "whois.tucows.com")], assert_equal [Whois::Answer::Part.new(referral, "whois.foo"), Whois::Answer::Part.new(response, "whois.markmonitor.com")],
@server.buffer @server.buffer
end end

def test_query_with_referral_should_extract_the_closest_referral_server_with_more_servers
referral = File.read(File.dirname(__FILE__) + "/../../testcases/referrals/crsnic.com_more_servers.txt")
@server.expects(:ask_the_socket).with("=domain.foo", "whois.foo", 43).returns(referral)
@server.expects(:ask_the_socket).with("domain.foo", "whois.markmonitor.com", 43).returns("")
assert @server.query("domain.foo")
end

def test_query_with_referral_should_extract_the_closest_referral_server_with_more_servers
referral = File.read(File.dirname(__FILE__) + "/../../testcases/referrals/crsnic.com_one_server.txt")
@server.expects(:ask_the_socket).with("=domain.foo", "whois.foo", 43).returns(referral)
@server.expects(:ask_the_socket).with("domain.foo", "whois.godaddy.com", 43).returns("")
assert @server.query("domain.foo")
end


end end
210 changes: 210 additions & 0 deletions test/testcases/referrals/crsnic.com_more_servers.txt
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,210 @@

Whois Server Version 2.0

Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.

Server Name: GOOGLE.COM.ZZZZZ.GET.LAID.AT.WWW.SWINGINGCOMMUNITY.COM
IP Address: 69.41.185.195
Registrar: TUCOWS INC.
Whois Server: whois.tucows.com
Referral URL: http://domainhelp.opensrs.net

Server Name: GOOGLE.COM.ZZZZZ.DOWNLOAD.MOVIE.ONLINE.ZML2.COM
IP Address: 64.28.187.63
Registrar: DIRECTI INTERNET SOLUTIONS PVT. LTD. D/B/A PUBLICDOMAINREGISTRY.COM
Whois Server: whois.PublicDomainRegistry.com
Referral URL: http://www.PublicDomainRegistry.com

Server Name: GOOGLE.COM.ZOMBIED.AND.HACKED.BY.WWW.WEB-HACK.COM
IP Address: 217.107.217.167
Registrar: DOMAINCONTEXT, INC.
Whois Server: whois.domaincontext.com
Referral URL: http://www.domaincontext.com

Server Name: GOOGLE.COM.ZNAET.PRODOMEN.COM
IP Address: 62.149.23.126
Registrar: DIRECTI INTERNET SOLUTIONS PVT. LTD. D/B/A PUBLICDOMAINREGISTRY.COM
Whois Server: whois.PublicDomainRegistry.com
Referral URL: http://www.PublicDomainRegistry.com

Server Name: GOOGLE.COM.WORDT.DOOR.VEEL.WHTERS.GEBRUIKT.SERVERTJE.NET
IP Address: 62.41.27.144
Registrar: KEY-SYSTEMS GMBH
Whois Server: whois.rrpproxy.net
Referral URL: http://www.key-systems.net

Server Name: GOOGLE.COM.VN
Registrar: ONLINENIC, INC.
Whois Server: whois.onlinenic.com
Referral URL: http://www.OnlineNIC.com

Server Name: GOOGLE.COM.UY
Registrar: DIRECTI INTERNET SOLUTIONS PVT. LTD. D/B/A PUBLICDOMAINREGISTRY.COM
Whois Server: whois.PublicDomainRegistry.com
Referral URL: http://www.PublicDomainRegistry.com

Server Name: GOOGLE.COM.UA
Registrar: DIRECTI INTERNET SOLUTIONS PVT. LTD. D/B/A PUBLICDOMAINREGISTRY.COM
Whois Server: whois.PublicDomainRegistry.com
Referral URL: http://www.PublicDomainRegistry.com

Server Name: GOOGLE.COM.TW
Registrar: WEB COMMERCE COMMUNICATIONS LIMITED DBA WEBNIC.CC
Whois Server: whois.webnic.cc
Referral URL: http://www.webnic.cc

Server Name: GOOGLE.COM.TR
Registrar: DIRECTI INTERNET SOLUTIONS PVT. LTD. D/B/A PUBLICDOMAINREGISTRY.COM
Whois Server: whois.PublicDomainRegistry.com
Referral URL: http://www.PublicDomainRegistry.com

Server Name: GOOGLE.COM.SUCKS.FIND.CRACKZ.WITH.SEARCH.GULLI.COM
IP Address: 80.190.192.24
Registrar: EPAG DOMAINSERVICES GMBH
Whois Server: whois.enterprice.net
Referral URL: http://www.enterprice.net

Server Name: GOOGLE.COM.SPROSIUYANDEKSA.RU
Registrar: MELBOURNE IT, LTD. D/B/A INTERNET NAMES WORLDWIDE
Whois Server: whois.melbourneit.com
Referral URL: http://www.melbourneit.com

Server Name: GOOGLE.COM.SERVES.PR0N.FOR.ALLIYAH.NET
IP Address: 84.255.209.69
Registrar: GODADDY.COM, INC.
Whois Server: whois.godaddy.com
Referral URL: http://registrar.godaddy.com

Server Name: GOOGLE.COM.SA
Registrar: OMNIS NETWORK, LLC
Whois Server: whois.omnis.com
Referral URL: http://domains.omnis.com

Server Name: GOOGLE.COM.PLZ.GIVE.A.PR8.TO.AUDIOTRACKER.NET
IP Address: 213.251.184.30
Registrar: OVH
Whois Server: whois.ovh.com
Referral URL: http://www.ovh.com

Server Name: GOOGLE.COM.MX
Registrar: DIRECTI INTERNET SOLUTIONS PVT. LTD. D/B/A PUBLICDOMAINREGISTRY.COM
Whois Server: whois.PublicDomainRegistry.com
Referral URL: http://www.PublicDomainRegistry.com

Server Name: GOOGLE.COM.IS.SHIT.SQUAREBOARDS.COM
IP Address: 203.170.84.81
Registrar: AUST DOMAINS INTERNATIONAL PTY LTD DBA AUST DOMAINS, INC.
Whois Server: whois.syra.com.au
Referral URL: http://www.syra.com.au

Server Name: GOOGLE.COM.IS.NOT.HOSTED.BY.ACTIVEDOMAINDNS.NET
IP Address: 217.148.161.5
Registrar: ENOM, INC.
Whois Server: whois.enom.com
Referral URL: http://www.enom.com

Server Name: GOOGLE.COM.IS.HOSTED.ON.PROFITHOSTING.NET
IP Address: 66.49.213.213
Registrar: NAME.COM LLC
Whois Server: whois.name.com
Referral URL: http://www.name.com

Server Name: GOOGLE.COM.IS.APPROVED.BY.NUMEA.COM
IP Address: 213.228.0.43
Registrar: GANDI SAS
Whois Server: whois.gandi.net
Referral URL: http://www.gandi.net

Server Name: GOOGLE.COM.HAS.LESS.FREE.PORN.IN.ITS.SEARCH.ENGINE.THAN.SECZY.COM
IP Address: 209.187.114.130
Registrar: TUCOWS INC.
Whois Server: whois.tucows.com
Referral URL: http://domainhelp.opensrs.net

Server Name: GOOGLE.COM.DO
Registrar: GODADDY.COM, INC.
Whois Server: whois.godaddy.com
Referral URL: http://registrar.godaddy.com

Server Name: GOOGLE.COM.CO
Registrar: NAMESECURE.COM
Whois Server: whois.namesecure.com
Referral URL: http://www.namesecure.com

Server Name: GOOGLE.COM.BR
Registrar: ENOM, INC.
Whois Server: whois.enom.com
Referral URL: http://www.enom.com

Server Name: GOOGLE.COM.BEYONDWHOIS.COM
IP Address: 203.36.226.2
Registrar: TUCOWS INC.
Whois Server: whois.tucows.com
Referral URL: http://domainhelp.opensrs.net

Server Name: GOOGLE.COM.AU
Registrar: PLANETDOMAIN PTY LTD.
Whois Server: whois.planetdomain.com
Referral URL: http://www.planetdomain.com

Server Name: GOOGLE.COM.ACQUIRED.BY.CALITEC.NET
IP Address: 85.190.27.2
Registrar: ENOM, INC.
Whois Server: whois.enom.com
Referral URL: http://www.enom.com

Domain Name: GOOGLE.COM
Registrar: MARKMONITOR INC.
Whois Server: whois.markmonitor.com
Referral URL: http://www.markmonitor.com
Name Server: NS1.GOOGLE.COM
Name Server: NS2.GOOGLE.COM
Name Server: NS3.GOOGLE.COM
Name Server: NS4.GOOGLE.COM
Status: clientDeleteProhibited
Status: clientTransferProhibited
Status: clientUpdateProhibited
Status: serverDeleteProhibited
Status: serverTransferProhibited
Status: serverUpdateProhibited
Updated Date: 18-nov-2008
Creation Date: 15-sep-1997
Expiration Date: 14-sep-2011

>>> Last update of whois database: Mon, 06 Jul 2009 10:12:55 UTC <<<

NOTICE: The expiration date displayed in this record is the date the
registrar's sponsorship of the domain name registration in the registry is
currently set to expire. This date does not necessarily reflect the expiration
date of the domain name registrant's agreement with the sponsoring
registrar. Users may consult the sponsoring registrar's Whois database to
view the registrar's reported date of expiration for this registration.

TERMS OF USE: You are not authorized to access or query our Whois
database through the use of electronic processes that are high-volume and
automated except as reasonably necessary to register domain names or
modify existing registrations; the Data in VeriSign Global Registry
Services' ("VeriSign") Whois database is provided by VeriSign for
information purposes only, and to assist persons in obtaining information
about or related to a domain name registration record. VeriSign does not
guarantee its accuracy. By submitting a Whois query, you agree to abide
by the following terms of use: You agree that you may use this Data only
for lawful purposes and that under no circumstances will you use this Data
to: (1) allow, enable, or otherwise support the transmission of mass
unsolicited, commercial advertising or solicitations via e-mail, telephone,
or facsimile; or (2) enable high volume, automated, electronic processes
that apply to VeriSign (or its computer systems). The compilation,
repackaging, dissemination or other use of this Data is expressly
prohibited without the prior written consent of VeriSign. You agree not to
use electronic processes that are automated and high-volume to access or
query the Whois database except as reasonably necessary to register
domain names or modify existing registrations. VeriSign reserves the right
to restrict your access to the Whois database in its sole discretion to ensure
operational stability. VeriSign may restrict or terminate your access to the
Whois database for failure to abide by these terms of use. VeriSign
reserves the right to modify these terms at any time.

The Registry database contains ONLY .COM, .NET, .EDU domains and
Registrars.
57 changes: 57 additions & 0 deletions test/testcases/referrals/crsnic.com_one_server.txt
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,57 @@

Whois Server Version 2.0

Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.

Domain Name: WEPPOS.COM
Registrar: GODADDY.COM, INC.
Whois Server: whois.godaddy.com
Referral URL: http://registrar.godaddy.com
Name Server: NS1.DREAMHOST.COM
Name Server: NS2.DREAMHOST.COM
Name Server: NS3.DREAMHOST.COM
Status: clientDeleteProhibited
Status: clientRenewProhibited
Status: clientTransferProhibited
Status: clientUpdateProhibited
Updated Date: 08-dec-2008
Creation Date: 05-dec-2003
Expiration Date: 05-dec-2009

>>> Last update of whois database: Wed, 21 Oct 2009 10:33:33 UTC <<<

NOTICE: The expiration date displayed in this record is the date the
registrar's sponsorship of the domain name registration in the registry is
currently set to expire. This date does not necessarily reflect the expiration
date of the domain name registrant's agreement with the sponsoring
registrar. Users may consult the sponsoring registrar's Whois database to
view the registrar's reported date of expiration for this registration.

TERMS OF USE: You are not authorized to access or query our Whois
database through the use of electronic processes that are high-volume and
automated except as reasonably necessary to register domain names or
modify existing registrations; the Data in VeriSign Global Registry
Services' ("VeriSign") Whois database is provided by VeriSign for
information purposes only, and to assist persons in obtaining information
about or related to a domain name registration record. VeriSign does not
guarantee its accuracy. By submitting a Whois query, you agree to abide
by the following terms of use: You agree that you may use this Data only
for lawful purposes and that under no circumstances will you use this Data
to: (1) allow, enable, or otherwise support the transmission of mass
unsolicited, commercial advertising or solicitations via e-mail, telephone,
or facsimile; or (2) enable high volume, automated, electronic processes
that apply to VeriSign (or its computer systems). The compilation,
repackaging, dissemination or other use of this Data is expressly
prohibited without the prior written consent of VeriSign. You agree not to
use electronic processes that are automated and high-volume to access or
query the Whois database except as reasonably necessary to register
domain names or modify existing registrations. VeriSign reserves the right
to restrict your access to the Whois database in its sole discretion to ensure
operational stability. VeriSign may restrict or terminate your access to the
Whois database for failure to abide by these terms of use. VeriSign
reserves the right to modify these terms at any time.

The Registry database contains ONLY .COM, .NET, .EDU domains and
Registrars.

0 comments on commit 9ff17a7

Please sign in to comment.