Permalink
Browse files

Merge pull request #112 from weppos/noreferral

Support for non-deep querying
  • Loading branch information...
2 parents 1382187 + fb807f4 commit 06c842615286667c117e24811ee41715417e565a @weppos committed Nov 12, 2012
Showing with 404 additions and 218 deletions.
  1. +4 −0 CHANGELOG.md
  2. +14 −11 bin/ruby-whois
  3. +2 −0 lib/whois/client.rb
  4. +1 −1 lib/whois/record/parser/whois.aero.rb
  5. +1 −1 lib/whois/record/parser/whois.ati.tn.rb
  6. +1 −1 lib/whois/record/parser/whois.audns.net.au.rb
  7. +1 −1 lib/whois/record/parser/whois.cctld.by.rb
  8. +1 −1 lib/whois/record/parser/whois.cira.ca.rb
  9. +1 −1 lib/whois/record/parser/whois.co.ug.rb
  10. +1 −1 lib/whois/record/parser/whois.dk-hostmaster.dk.rb
  11. +1 −1 lib/whois/record/parser/whois.dns.be.rb
  12. +1 −1 lib/whois/record/parser/whois.dns.hr.rb
  13. +6 −8 lib/whois/record/parser/whois.dns.pt.rb
  14. +1 −1 lib/whois/record/parser/whois.domain-registry.nl.rb
  15. +1 −1 lib/whois/record/parser/whois.domainregistry.ie.rb
  16. +1 −1 lib/whois/record/parser/whois.fi.rb
  17. +3 −3 lib/whois/record/parser/whois.godaddy.com.rb
  18. +1 −1 lib/whois/record/parser/whois.nc.rb
  19. +1 −1 lib/whois/record/parser/whois.nic.at.rb
  20. +1 −1 lib/whois/record/parser/whois.nic.cz.rb
  21. +1 −1 lib/whois/record/parser/whois.nic.dm.rb
  22. +1 −1 lib/whois/record/parser/whois.nic.fo.rb
  23. +1 −1 lib/whois/record/parser/whois.nic.gov.rb
  24. +1 −1 lib/whois/record/parser/whois.nic.hn.rb
  25. +1 −1 lib/whois/record/parser/whois.nic.lk.rb
  26. +1 −1 lib/whois/record/parser/whois.nic.name.rb
  27. +31 −13 lib/whois/record/parser/whois.nic.pr.rb
  28. +1 −1 lib/whois/record/parser/whois.registry.om.rb
  29. +1 −1 lib/whois/record/parser/whois.registrypro.pro.rb
  30. +1 −1 lib/whois/record/parser/whois.rnids.rs.rb
  31. +1 −1 lib/whois/record/parser/whois.sx.rb
  32. +1 −1 lib/whois/record/parser/whois.tcinet.ru.rb
  33. +1 −1 lib/whois/record/parser/whois.tld.ee.rb
  34. +1 −1 lib/whois/record/parser/whois.tznic.or.tz.rb
  35. +7 −12 lib/whois/server/adapters/afilias.rb
  36. +10 −18 lib/whois/server/adapters/verisign.rb
  37. +1 −1 spec/fixtures/responses/whois.dns.pt/status_available.txt
  38. +1 −1 spec/fixtures/responses/whois.dns.pt/status_registered.expected
  39. +1 −1 spec/fixtures/responses/whois.dns.pt/status_registered.txt
  40. +22 −1 spec/fixtures/responses/whois.nic.pr/status_available.expected
  41. +23 −20 spec/fixtures/responses/whois.nic.pr/status_available.txt
  42. +32 −3 spec/fixtures/responses/whois.nic.pr/status_registered.expected
  43. +31 −62 spec/fixtures/responses/whois.nic.pr/status_registered.txt
  44. +14 −2 spec/fixtures/responses/whois.pnina.ps/status_available.txt
  45. +1 −1 spec/fixtures/responses/whois.pnina.ps/status_registered.expected
  46. +53 −3 spec/fixtures/responses/whois.pnina.ps/status_registered.txt
  47. +1 −1 spec/whois/record/parser/responses/whois.dns.pt/status_registered_spec.rb
  48. +32 −1 spec/whois/record/parser/responses/whois.nic.pr/status_available_spec.rb
  49. +42 −3 spec/whois/record/parser/responses/whois.nic.pr/status_registered_spec.rb
  50. +1 −1 spec/whois/record/parser/responses/whois.pnina.ps/status_registered_spec.rb
  51. +17 −7 spec/whois/server/adapters/afilias_spec.rb
  52. +27 −17 spec/whois/server/adapters/verisign_spec.rb
  53. 0 utils/compare-whois.rb
  54. 0 utils/fixupd.rb
View
@@ -15,6 +15,8 @@
- NEW: Added full whois.nic.pw parser.
+- NEW: Support for non-deep querying (GH-112)
+
- CHANGED: Dropped support for Ruby 1.8
- CHANGED: Renamed Whois::Record::Scanners::Ast to Renamed Whois::Record::Scanners::Nodable
@@ -53,6 +55,8 @@
- CHANGED: Removed deprecated options[:web] for :web adapter.
+- CHANGED: Updated whois.nic.pr parser to the new response format.
+
- FIXED: whois.domainregistry.ie should support status `Active - LOCKED`.
- FIXED: whois.nic.uk fails to parse registrars without URL (GH-188).
View
@@ -3,11 +3,10 @@
$:.unshift(File.expand_path("../../lib", __FILE__))
require 'optparse'
-require 'ostruct'
require 'whois'
-options = OpenStruct.new
+options = {}
OptionParser.new do |opts|
opts.banner = "Whois: an intelligent pure Ruby Whois client"
opts.define_head "Usage: ruby-whois [options] object"
@@ -18,20 +17,24 @@ OptionParser.new do |opts|
opts.separator ""
opts.separator "Options:"
- opts.on("-t", "--timeout [SECONDS]", Integer, "specify the timeout value") do |seconds|
- options.timeout = seconds
+ opts.on("-t", "--timeout [SECONDS]", Integer, "set the timeout") do |seconds|
+ options[:timeout] = seconds
end
- opts.on_tail("--help", "Show this message") do
- puts opts
- exit
+ opts.on("-h", "--host [HOST]", String, "connect to server HOST") do |host|
+ options[:host] = host
end
- opts.on("-h", "--host [HOST]", String, "connect to server HOST") do |host|
- options.host = host
+ opts.on("--[no-]referral", "skip referral queries") do |boolean|
+ options[:referral] = boolean
+ end
+
+ opts.on_tail("--help", "show this help and exit") do
+ puts opts
+ exit
end
- opts.on_tail("-v", "--version", "show version") do
+ opts.on_tail("--version", "output version information and exit") do
puts "#{Whois::NAME} #{Whois::VERSION}"
exit
end
@@ -52,7 +55,7 @@ end
object = ARGV.shift
begin
- @client = Whois::Client.new(:timeout => options.timeout, :host => options.host)
+ @client = Whois::Client.new(options)
puts @client.query(object)
rescue Whois::Error => e
abort(e.message)
View
@@ -41,6 +41,8 @@ class Client
# to the specific local port.
# @option settings [String, nil] :host (nil)
# The server host to query. Leave it blank for intelligent detection.
+ # @option settings [Boolean, nil] :referral (nil)
+ # Set to +false+ to disable queries to referral WHOIS servers.
#
# @yield [self]
#
@@ -15,7 +15,7 @@ class Record
class Parser
# Parser for the whois.aero server.
- #
+ #
# @see Whois::Record::Parser::Example
# The Example parser for the list of all available methods.
#
@@ -16,7 +16,7 @@ class Record
class Parser
# Parser for the whois.ati.tn server.
- #
+ #
# @see Whois::Record::Parser::Example
# The Example parser for the list of all available methods.
#
@@ -16,7 +16,7 @@ class Record
class Parser
# Parser for the whois.audns.net.au server.
- #
+ #
# @see Whois::Record::Parser::Example
# The Example parser for the list of all available methods.
#
@@ -14,7 +14,7 @@ class Record
class Parser
# Parser for the whois.cctld.by server.
- #
+ #
# @see Whois::Record::Parser::Example
# The Example parser for the list of all available methods.
#
@@ -16,7 +16,7 @@ class Record
class Parser
# Parser for the whois.cira.ca server.
- #
+ #
# @see Whois::Record::Parser::Example
# The Example parser for the list of all available methods.
#
@@ -19,7 +19,7 @@ class Parser
# @note This parser is just a stub and provides only a few basic methods
# to check for domain availability and get domain status.
# Please consider to contribute implementing missing methods.
- #
+ #
# @see Whois::Record::Parser::Example
# The Example parser for the list of all available methods.
#
@@ -19,7 +19,7 @@ class Parser
# @note This parser is just a stub and provides only a few basic methods
# to check for domain availability and get domain status.
# Please consider to contribute implementing missing methods.
- #
+ #
# @see Whois::Record::Parser::Example
# The Example parser for the list of all available methods.
#
@@ -19,7 +19,7 @@ class Parser
# @note This parser is just a stub and provides only a few basic methods
# to check for domain availability and get domain status.
# Please consider to contribute implementing missing methods.
- #
+ #
# @see Whois::Record::Parser::Example
# The Example parser for the list of all available methods.
#
@@ -16,7 +16,7 @@ class Record
class Parser
# Parser for the whois.dns.hr server.
- #
+ #
# @see Whois::Record::Parser::Example
# The Example parser for the list of all available methods.
#
@@ -14,16 +14,14 @@ module Whois
class Record
class Parser
- #
- # = whois.dns.pt parser
- #
# Parser for the whois.dns.pt server.
#
- # NOTE: This parser is just a stub and provides only a few basic methods
- # to check for domain availability and get domain status.
- # Please consider to contribute implementing missing methods.
- # See WhoisNicIt parser for an explanation of all available methods
- # and examples.
+ # @note This parser is just a stub and provides only a few basic methods
+ # to check for domain availability and get domain status.
+ # Please consider to contribute implementing missing methods.
+ #
+ # @see Whois::Record::Parser::Example
+ # The Example parser for the list of all available methods.
#
class WhoisDnsPt < Base
@@ -19,7 +19,7 @@ class Parser
# @note This parser is just a stub and provides only a few basic methods
# to check for domain availability and get domain status.
# Please consider to contribute implementing missing methods.
- #
+ #
# @see Whois::Record::Parser::Example
# The Example parser for the list of all available methods.
#
@@ -16,7 +16,7 @@ class Record
class Parser
# Parser for the whois.domainregistry.ie server.
- #
+ #
# @see Whois::Record::Parser::Example
# The Example parser for the list of all available methods.
#
@@ -19,7 +19,7 @@ class Parser
# @note This parser is just a stub and provides only a few basic methods
# to check for domain availability and get domain status.
# Please consider to contribute implementing missing methods.
- #
+ #
# @see Whois::Record::Parser::Example
# The Example parser for the list of all available methods.
#
@@ -15,7 +15,7 @@ class Record
class Parser
# Parser for the whois.godaddy.com server.
- #
+ #
# @see Whois::Record::Parser::Example
# The Example parser for the list of all available methods.
#
@@ -41,13 +41,13 @@ class WhoisGodaddyCom < Base
# Time.parse($1)
# end
# end
- #
+ #
# property_supported :updated_on do
# if content_for_scanner =~ /Last Updated on: (.+)\n/
# Time.parse($1)
# end
# end
- #
+ #
# property_supported :expires_on do
# if content_for_scanner =~ /Expires on: (.+)\n/
# Time.parse($1)
@@ -16,7 +16,7 @@ class Record
class Parser
# Parser for the whois.nc server.
- #
+ #
# @see Whois::Record::Parser::Example
# The Example parser for the list of all available methods.
#
@@ -19,7 +19,7 @@ class Parser
# @note This parser is just a stub and provides only a few basic methods
# to check for domain availability and get domain status.
# Please consider to contribute implementing missing methods.
- #
+ #
# @see Whois::Record::Parser::Example
# The Example parser for the list of all available methods.
#
@@ -15,7 +15,7 @@ class Record
class Parser
# Parser for the whois.nic.cz server.
- #
+ #
# @see Whois::Record::Parser::Example
# The Example parser for the list of all available methods.
#
@@ -16,7 +16,7 @@ class Record
class Parser
# Parser for the whois.nic.dm server.
- #
+ #
# @see Whois::Record::Parser::Example
# The Example parser for the list of all available methods.
#
@@ -15,7 +15,7 @@ class Record
class Parser
# Parser for the whois.nic.fo server.
- #
+ #
# @see Whois::Record::Parser::Example
# The Example parser for the list of all available methods.
#
@@ -19,7 +19,7 @@ class Parser
# @note This parser is just a stub and provides only a few basic methods
# to check for domain availability and get domain status.
# Please consider to contribute implementing missing methods.
- #
+ #
# @see Whois::Record::Parser::Example
# The Example parser for the list of all available methods.
#
@@ -15,7 +15,7 @@ class Record
class Parser
# Parser for the whois.nic.hn server.
- #
+ #
# @see Whois::Record::Parser::Example
# The Example parser for the list of all available methods.
#
@@ -15,7 +15,7 @@ class Record
class Parser
# Parser for the whois.nic.lk server.
- #
+ #
# @see Whois::Record::Parser::Example
# The Example parser for the list of all available methods.
#
@@ -19,7 +19,7 @@ class Parser
# @note This parser is just a stub and provides only a few basic methods
# to check for domain availability and get domain status.
# Please consider to contribute implementing missing methods.
- #
+ #
# @see Whois::Record::Parser::Example
# The Example parser for the list of all available methods.
#
@@ -14,19 +14,24 @@ module Whois
class Record
class Parser
+ # Parser for the whois.nic.pr server.
#
- # = whois.nic.pr parser
- #
- # Parser for the whois.nic.or server.
- #
- # NOTE: This parser is just a stub and provides only a few basic methods
- # to check for domain availability and get domain status.
- # Please consider to contribute implementing missing methods.
- # See WhoisNicIt parser for an explanation of all available methods
- # and examples.
+ # @see Whois::Record::Parser::Example
+ # The Example parser for the list of all available methods.
#
class WhoisNicPr < Base
+ property_supported :domain do
+ if content_for_scanner =~ /^Domain:\s+(.+)\n/
+ $1
+ elsif content_for_scanner =~ /^The domain (.+?) is not registered\.\n/
+ $1
+ end
+ end
+
+ property_not_supported :domain_id
+
+
property_supported :status do
if available?
:available
@@ -36,7 +41,7 @@ class WhoisNicPr < Base
end
property_supported :available? do
- !(content_for_scanner =~ /^Domain: (.+?)\n/)
+ !!(content_for_scanner =~ /^The domain (.+?) is not registered\.\n/)
end
property_supported :registered? do
@@ -45,21 +50,34 @@ class WhoisNicPr < Base
property_supported :created_on do
- if content_for_scanner =~ /Created on:(.+?)\n/
+ if content_for_scanner =~ /Created On:\s+(.+)\n/
Time.parse($1)
end
end
property_not_supported :updated_on
property_supported :expires_on do
- if content_for_scanner =~ /Expires on:(.+?)\n/
+ if content_for_scanner =~ /Expires On:\s+(.+)\n/
Time.parse($1)
end
end
- property_not_supported :nameservers
+ property_not_supported :registrar
+
+ property_not_supported :registrant_contacts
+
+ property_not_supported :admin_contacts
+
+ property_not_supported :technical_contacts
+
+
+ property_supported :nameservers do
+ content_for_scanner.scan(/DNS:\s+(.+)\n/).flatten.map do |name|
+ Record::Nameserver.new(:name => name)
+ end
+ end
end
Oops, something went wrong.

0 comments on commit 06c8426

Please sign in to comment.