Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Afilias is using a slightly different response for .INFO and .XXX (cl…

…oses GH-304)
  • Loading branch information...
commit 849c3ee35c432866f02b762d48a462911e60f70c 1 parent 82ee567
@weppos authored
View
2  CHANGELOG.md
@@ -15,6 +15,8 @@
- CHANGED: Updated whois.pandi.or.id parser to the new response format.
+- CHANGED: Afilias is using a slightly different whois response for some TLDs, including .INFO and .XXX (GH-304)
+
## Release 3.4.4
View
141 lib/whois/record/parser/base_afilias2.rb
@@ -0,0 +1,141 @@
+#--
+# Ruby Whois
+#
+# An intelligent pure Ruby WHOIS client and parser.
+#
+# Copyright (c) 2009-2014 Simone Carletti <weppos@weppos.net>
+#++
+
+
+require 'whois/record/parser/base'
+require 'whois/record/scanners/base_afilias'
+
+
+module Whois
+ class Record
+ class Parser
+
+ # Base parser for Afilias servers.
+ #
+ # @abstract
+ class BaseAfilias2 < Base
+ include Scanners::Scannable
+
+ self.scanner = Scanners::BaseAfilias
+
+
+ property_supported :disclaimer do
+ node("field:disclaimer")
+ end
+
+
+ property_supported :domain do
+ node("Domain Name", &:downcase)
+ end
+
+ property_supported :domain_id do
+ node("Domain ID")
+ end
+
+
+ property_supported :status do
+ Array.wrap(node("Domain Status"))
+ end
+
+ property_supported :available? do
+ !!node("status:available")
+ end
+
+ property_supported :registered? do
+ !available?
+ end
+
+
+ property_supported :created_on do
+ node("Creation Date") do |value|
+ Time.parse(value)
+ end
+ end
+
+ property_supported :updated_on do
+ node("Updated Date") do |value|
+ Time.parse(value)
+ end
+ end
+
+ property_supported :expires_on do
+ node("Registry Expiry Date") do |value|
+ Time.parse(value)
+ end
+ end
+
+
+ property_supported :registrar do
+ node("Sponsoring Registrar") do |value|
+ id, name = decompose_registrar(value) ||
+ Whois.bug!(ParserError, "Unknown registrar format `#{value}'")
+
+ Record::Registrar.new(
+ id: id,
+ name: name
+ )
+ end
+ end
+
+ property_supported :registrant_contacts do
+ build_contact("Registrant", Whois::Record::Contact::TYPE_REGISTRANT)
+ end
+
+ property_supported :admin_contacts do
+ build_contact("Admin", Whois::Record::Contact::TYPE_ADMINISTRATIVE)
+ end
+
+ property_supported :technical_contacts do
+ build_contact("Tech", Whois::Record::Contact::TYPE_TECHNICAL)
+ end
+
+
+ property_supported :nameservers do
+ Array.wrap(node("Name Server")).reject(&:empty?).map do |name|
+ Nameserver.new(:name => name.downcase)
+ end
+ end
+
+
+ private
+
+ def build_contact(element, type)
+ node("#{element} ID") do
+ address = ["", "1", "2", "3"].
+ map { |i| node("#{element} Street#{i}") }.
+ delete_if { |i| i.nil? || i.empty? }.
+ join("\n")
+
+ Record::Contact.new(
+ :type => type,
+ :id => node("#{element} ID"),
+ :name => node("#{element} Name"),
+ :organization => node("#{element} Organization"),
+ :address => address,
+ :city => node("#{element} City"),
+ :zip => node("#{element} Postal Code"),
+ :state => node("#{element} State/Province"),
+ :country_code => node("#{element} Country"),
+ :phone => node("#{element} Phone"),
+ :fax => node("#{element} FAX") || node("#{element} Fax"),
+ :email => node("#{element} Email")
+ )
+ end
+ end
+
+ def decompose_registrar(value)
+ if value =~ /(.+?) \((.+?)\)/
+ [$2, $1]
+ end
+ end
+
+ end
+
+ end
+ end
+end
View
9 lib/whois/record/parser/whois.afilias.info.rb
@@ -7,7 +7,7 @@
#++
-require 'whois/record/parser/base_afilias'
+require 'whois/record/parser/base_afilias2'
module Whois
@@ -15,7 +15,12 @@ class Record
class Parser
# Parser for the whois.afilias.info server.
- class WhoisAfiliasInfo < BaseAfilias
+ class WhoisAfiliasInfo < BaseAfilias2
+
+ self.scanner = Scanners::BaseAfilias, {
+ pattern_disclaimer: /^Access to/
+ }
+
end
end
View
25 lib/whois/record/parser/whois.nic.xxx.rb
@@ -7,7 +7,7 @@
#++
-require 'whois/record/parser/base_afilias'
+require 'whois/record/parser/base_afilias2'
module Whois
@@ -15,7 +15,7 @@ class Record
class Parser
# Parser for the whois.nic.xxx server.
- class WhoisNicXxx < BaseAfilias
+ class WhoisNicXxx < BaseAfilias2
self.scanner = Scanners::BaseAfilias, {
pattern_disclaimer: /^Access to/
@@ -26,26 +26,7 @@ class WhoisNicXxx < BaseAfilias
if reserved?
:reserved
else
- Array.wrap(node("Domain Status"))
- end
- end
-
-
- property_supported :created_on do
- node("Creation Date") do |value|
- Time.parse(value)
- end
- end
-
- property_supported :updated_on do
- node("Updated Date") do |value|
- Time.parse(value)
- end
- end
-
- property_supported :expires_on do
- node("Registry Expiry Date") do |value|
- Time.parse(value)
+ super()
end
end
View
4 spec/fixtures/responses/whois.afilias.info/status_registered.expected
@@ -1,5 +1,5 @@
#disclaimer
- %s == "Access to INFO WHOIS information is provided to assist persons in determining the contents of a domain name registration record in the Afilias registry database. The data in this record is provided by Afilias Limited for informational purposes only, and Afilias does not guarantee its accuracy. This service is intended only for query-based access. You agree that you will use this data only for lawful purposes and that, under no circumstances will you use this data to: (a) allow, enable, or otherwise support the transmission by e-mail, telephone, or facsimile of mass unsolicited, commercial advertising or solicitations to entities other than the data recipient's own existing customers; or (b) enable high volume, automated, electronic processes that send queries or data to the systems of Registry Operator, a Registrar, or Afilias except as reasonably necessary to register domain names or modify existing registrations. All rights reserved. Afilias reserves the right to modify these terms at any time. By submitting this query, you agree to abide by this policy."
+ %s == "Access to AFILIAS WHOIS information is provided to assist persons in determining the contents of a domain name registration record in the Afilias registry database. The data in this record is provided by Afilias Limited for informational purposes only, and Afilias does not guarantee its accuracy. This service is intended only for query-based access. You agree that you will use this data only for lawful purposes and that, under no circumstances will you use this data to(a) allow, enable, or otherwise support the transmission by e-mail, telephone, or facsimile of mass unsolicited, commercial advertising or solicitations to entities other than the data recipient's own existing customers; or (b) enable high volume, automated, electronic processes that send queries or data to the systems of Registry Operator, a Registrar, or Afilias except as reasonably necessary to register domain names or modify existing registrations. All rights reserved. Afilias reserves the right to modify these terms at any time. By submitting this query, you agree to abide by this policy."
#domain
@@ -10,7 +10,7 @@
#status
- %s == ["CLIENT DELETE PROHIBITED", "CLIENT TRANSFER PROHIBITED", "CLIENT UPDATE PROHIBITED"]
+ %s == ["clientDeleteProhibited", "clientTransferProhibited", "clientUpdateProhibited"]
#available?
%s == false
View
76 spec/fixtures/responses/whois.afilias.info/status_registered.txt
@@ -1,92 +1,70 @@
-Access to INFO WHOIS information is provided to assist persons in
-determining the contents of a domain name registration record in the
-Afilias registry database. The data in this record is provided by
-Afilias Limited for informational purposes only, and Afilias does not
-guarantee its accuracy. This service is intended only for query-based
-access. You agree that you will use this data only for lawful purposes
-and that, under no circumstances will you use this data to: (a) allow,
-enable, or otherwise support the transmission by e-mail, telephone, or
-facsimile of mass unsolicited, commercial advertising or solicitations
-to entities other than the data recipient's own existing customers; or
-(b) enable high volume, automated, electronic processes that send
-queries or data to the systems of Registry Operator, a Registrar, or
-Afilias except as reasonably necessary to register domain names or
-modify existing registrations. All rights reserved. Afilias reserves
-the right to modify these terms at any time. By submitting this query,
-you agree to abide by this policy.
-
-Domain ID:D37288-LRMS
Domain Name:GOOGLE.INFO
-Created On:31-Jul-2001 23:57:50 UTC
-Last Updated On:29-Jun-2013 09:26:18 UTC
-Expiration Date:31-Jul-2014 23:57:50 UTC
+Domain ID: D37288-LRMS
+Creation Date: 2001-07-31T23:57:50Z
+Updated Date: 2013-06-29T09:26:18Z
+Registry Expiry Date: 2014-07-31T23:57:50Z
Trademark Name:GOOGLE
Trademark Date:1999-09-17
Trademark Country:Mexico
Trademark Number:622722
Sponsoring Registrar:MarkMonitor Inc. (R151-LRMS)
-Status:CLIENT DELETE PROHIBITED
-Status:CLIENT TRANSFER PROHIBITED
-Status:CLIENT UPDATE PROHIBITED
+Sponsoring Registrar IANA ID: 292
+WHOIS Server:
+Referral URL:
+Domain Status: clientDeleteProhibited
+Domain Status: clientTransferProhibited
+Domain Status: clientUpdateProhibited
Registrant ID:mmr-32097
Registrant Name:DNS Admin
Registrant Organization:Google Inc.
-Registrant Street1:1600 Amphitheatre Parkway
-Registrant Street2:
-Registrant Street3:
+Registrant Street: 1600 Amphitheatre Parkway
Registrant City:Mountain View
Registrant State/Province:CA
Registrant Postal Code:94043
Registrant Country:US
Registrant Phone:+1.6506234000
-Registrant Phone Ext.:
-Registrant FAX:+1.6506188571
-Registrant FAX Ext.:
+Registrant Phone Ext:
+Registrant Fax: +1.6506188571
+Registrant Fax Ext:
Registrant Email:dns-admin@google.com
Admin ID:mmr-32097
Admin Name:DNS Admin
Admin Organization:Google Inc.
-Admin Street1:1600 Amphitheatre Parkway
-Admin Street2:
-Admin Street3:
+Admin Street: 1600 Amphitheatre Parkway
Admin City:Mountain View
Admin State/Province:CA
Admin Postal Code:94043
Admin Country:US
Admin Phone:+1.6506234000
-Admin Phone Ext.:
-Admin FAX:+1.6506188571
-Admin FAX Ext.:
+Admin Phone Ext:
+Admin Fax: +1.6506188571
+Admin Fax Ext:
Admin Email:dns-admin@google.com
Billing ID:mmr-32097
Billing Name:DNS Admin
Billing Organization:Google Inc.
-Billing Street1:1600 Amphitheatre Parkway
-Billing Street2:
-Billing Street3:
+Billing Street: 1600 Amphitheatre Parkway
Billing City:Mountain View
Billing State/Province:CA
Billing Postal Code:94043
Billing Country:US
Billing Phone:+1.6506234000
-Billing Phone Ext.:
-Billing FAX:+1.6506188571
-Billing FAX Ext.:
+Billing Phone Ext:
+Billing Fax: +1.6506188571
+Billing Fax Ext:
Billing Email:dns-admin@google.com
Tech ID:mmr-32097
Tech Name:DNS Admin
Tech Organization:Google Inc.
-Tech Street1:1600 Amphitheatre Parkway
-Tech Street2:
-Tech Street3:
+Tech Street: 1600 Amphitheatre Parkway
Tech City:Mountain View
Tech State/Province:CA
Tech Postal Code:94043
Tech Country:US
Tech Phone:+1.6506234000
-Tech Phone Ext.:
-Tech FAX:+1.6506188571
-Tech FAX Ext.:
+Tech Phone Ext:
+Tech Fax: +1.6506188571
+Tech Fax Ext:
Tech Email:dns-admin@google.com
Name Server:NS1.GOOGLE.COM
Name Server:NS2.GOOGLE.COM
@@ -103,4 +81,6 @@ Name Server:
Name Server:
DNSSEC:Unsigned
+Access to AFILIAS WHOIS information is provided to assist persons in determining the contents of a domain name registration record in the Afilias registry database. The data in this record is provided by Afilias Limited for informational purposes only, and Afilias does not guarantee its accuracy. This service is intended only for query-based access. You agree that you will use this data only for lawful purposes and that, under no circumstances will you use this data to(a) allow, enable, or otherwise support the transmission by e-mail, telephone, or facsimile of mass unsolicited, commercial advertising or solicitations to entities other than the data recipient's own existing customers; or (b) enable high volume, automated, electronic processes that send queries or data to the systems of Registry Operator, a Registrar, or Afilias except as reasonably necessary to register domain names or modify existing registrations. All rights reserved. Afilias reserves the right to modify these terms at any time. By submitting this query, you agree to abide by this policy.
+
View
4 spec/fixtures/responses/whois.nic.ag/status_registered.expected
@@ -25,11 +25,11 @@
#updated_on
%s %CLASS{time}
- %s %TIME{2009-12-09 19:28:04 UTC}
+ %s %TIME{2013-12-04 10:20:49 UTC}
#expires_on
%s %CLASS{time}
- %s %TIME{2011-01-05 14:06:59 UTC}
+ %s %TIME{2015-01-05 14:06:59 UTC}
#registrar
View
6 spec/fixtures/responses/whois.nic.ag/status_registered.txt
@@ -18,8 +18,8 @@ you agree to abide by this policy.
Domain ID:D48552-LRCC
Domain Name:GOOGLE.AG
Created On:05-Jan-2003 14:06:59 UTC
-Last Updated On:09-Dec-2009 19:28:04 UTC
-Expiration Date:05-Jan-2011 14:06:59 UTC
+Last Updated On:04-Dec-2013 10:20:49 UTC
+Expiration Date:05-Jan-2015 14:06:59 UTC
Sponsoring Registrar:MarkMonitor, Inc. (R22-LRCC)
Status:CLIENT DELETE PROHIBITED
Status:CLIENT TRANSFER PROHIBITED
@@ -97,4 +97,4 @@ Name Server:
Name Server:
Name Server:
Name Server:
-
+
View
4 spec/whois/record/parser/responses/whois.afilias.info/status_registered_spec.rb
@@ -23,7 +23,7 @@
describe "#disclaimer" do
it do
- expect(subject.disclaimer).to eq("Access to INFO WHOIS information is provided to assist persons in determining the contents of a domain name registration record in the Afilias registry database. The data in this record is provided by Afilias Limited for informational purposes only, and Afilias does not guarantee its accuracy. This service is intended only for query-based access. You agree that you will use this data only for lawful purposes and that, under no circumstances will you use this data to: (a) allow, enable, or otherwise support the transmission by e-mail, telephone, or facsimile of mass unsolicited, commercial advertising or solicitations to entities other than the data recipient's own existing customers; or (b) enable high volume, automated, electronic processes that send queries or data to the systems of Registry Operator, a Registrar, or Afilias except as reasonably necessary to register domain names or modify existing registrations. All rights reserved. Afilias reserves the right to modify these terms at any time. By submitting this query, you agree to abide by this policy.")
+ expect(subject.disclaimer).to eq("Access to AFILIAS WHOIS information is provided to assist persons in determining the contents of a domain name registration record in the Afilias registry database. The data in this record is provided by Afilias Limited for informational purposes only, and Afilias does not guarantee its accuracy. This service is intended only for query-based access. You agree that you will use this data only for lawful purposes and that, under no circumstances will you use this data to(a) allow, enable, or otherwise support the transmission by e-mail, telephone, or facsimile of mass unsolicited, commercial advertising or solicitations to entities other than the data recipient's own existing customers; or (b) enable high volume, automated, electronic processes that send queries or data to the systems of Registry Operator, a Registrar, or Afilias except as reasonably necessary to register domain names or modify existing registrations. All rights reserved. Afilias reserves the right to modify these terms at any time. By submitting this query, you agree to abide by this policy.")
end
end
describe "#domain" do
@@ -38,7 +38,7 @@
end
describe "#status" do
it do
- expect(subject.status).to eq(["CLIENT DELETE PROHIBITED", "CLIENT TRANSFER PROHIBITED", "CLIENT UPDATE PROHIBITED"])
+ expect(subject.status).to eq(["clientDeleteProhibited", "clientTransferProhibited", "clientUpdateProhibited"])
end
end
describe "#available?" do
View
4 spec/whois/record/parser/responses/whois.nic.ag/status_registered_spec.rb
@@ -60,13 +60,13 @@
describe "#updated_on" do
it do
expect(subject.updated_on).to be_a(Time)
- expect(subject.updated_on).to eq(Time.parse("2009-12-09 19:28:04 UTC"))
+ expect(subject.updated_on).to eq(Time.parse("2013-12-04 10:20:49 UTC"))
end
end
describe "#expires_on" do
it do
expect(subject.expires_on).to be_a(Time)
- expect(subject.expires_on).to eq(Time.parse("2011-01-05 14:06:59 UTC"))
+ expect(subject.expires_on).to eq(Time.parse("2015-01-05 14:06:59 UTC"))
end
end
describe "#registrar" do
View
2  spec/whois/record/parser/responses/whois.nic.lv/status_registered_spec.rb
@@ -44,7 +44,7 @@
describe "#updated_on" do
it do
expect(subject.updated_on).to be_a(Time)
- expect(subject.updated_on).to eq(Time.parse("2013-07-08 18:35:53 UTC"))
+ expect(subject.updated_on).to eq(Time.parse("2013-07-08 19:35:53 +03:00"))
end
end
describe "#expires_on" do
Please sign in to comment.
Something went wrong with that request. Please try again.