whois 2.6.2 → 2.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/.yardopts +1 -1
  2. data/CHANGELOG.md +13 -0
  3. data/README.md +11 -13
  4. data/lib/whois.rb +2 -2
  5. data/lib/whois/errors.rb +1 -1
  6. data/lib/whois/record.rb +49 -43
  7. data/lib/whois/record/parser.rb +102 -102
  8. data/lib/whois/record/parser/base.rb +4 -4
  9. data/lib/whois/record/parser/whois.aero.rb +4 -0
  10. data/lib/whois/record/parser/whois.ati.tn.rb +1 -1
  11. data/lib/whois/record/parser/whois.audns.net.au.rb +1 -1
  12. data/lib/whois/record/parser/whois.cira.ca.rb +1 -1
  13. data/lib/whois/record/parser/whois.dns.hr.rb +1 -1
  14. data/lib/whois/record/parser/whois.dreamhost.com.rb +1 -1
  15. data/lib/whois/record/parser/whois.enom.com.rb +1 -1
  16. data/lib/whois/record/parser/whois.fi.rb +1 -1
  17. data/lib/whois/record/parser/whois.nc.rb +1 -1
  18. data/lib/whois/record/parser/whois.networksolutions.com.rb +1 -1
  19. data/lib/whois/record/parser/whois.nic.lk.rb +1 -1
  20. data/lib/whois/record/parser/whois.registry.om.rb +1 -1
  21. data/lib/whois/record/parser/whois.registrypro.pro.rb +5 -50
  22. data/lib/whois/record/parser/whois.rnids.rs.rb +1 -1
  23. data/lib/whois/record/parser/whois.sx.rb +1 -1
  24. data/lib/whois/record/parser/whois.ua.rb +2 -2
  25. data/lib/whois/record/scanners/whois.ati.tn.rb +1 -1
  26. data/lib/whois/record/scanners/whois.audns.net.au.rb +1 -1
  27. data/lib/whois/record/scanners/whois.centralnic.com.rb +1 -1
  28. data/lib/whois/record/scanners/whois.cira.ca.rb +1 -1
  29. data/lib/whois/record/scanners/whois.dns.hr.rb +1 -1
  30. data/lib/whois/record/scanners/whois.nc.rb +1 -1
  31. data/lib/whois/record/scanners/whois.registry.om.rb +1 -1
  32. data/lib/whois/record/scanners/whois.rnids.rs.rb +1 -1
  33. data/lib/whois/record/scanners/whois.sx.rb +1 -1
  34. data/lib/whois/server.rb +9 -5
  35. data/lib/whois/server/adapters/base.rb +3 -3
  36. data/lib/whois/version.rb +1 -1
  37. data/spec/fixtures/responses/whois.aero/status_registered.expected +36 -36
  38. data/spec/fixtures/responses/whois.registrypro.pro/status_available.expected +34 -0
  39. data/spec/fixtures/responses/whois.registrypro.pro/status_available.txt +1 -20
  40. data/spec/fixtures/responses/whois.registrypro.pro/status_registered.expected +87 -9
  41. data/spec/fixtures/responses/whois.registrypro.pro/status_registered.txt +94 -55
  42. data/spec/fixtures/responses/whois.ua/property_created_at_outofrange.expected +2 -0
  43. data/spec/fixtures/responses/whois.ua/property_created_at_outofrange.txt +93 -0
  44. data/spec/tlds +1 -1
  45. data/spec/whois/record/parser/responses/whois.aero/status_registered_spec.rb +36 -36
  46. data/spec/whois/record/parser/responses/whois.registrypro.pro/status_available_spec.rb +48 -0
  47. data/spec/whois/record/parser/responses/whois.registrypro.pro/status_registered_spec.rb +101 -9
  48. data/spec/whois/record/parser/responses/whois.ua/property_created_at_outofrange_spec.rb +29 -0
  49. data/spec/whois/record/parser_spec.rb +4 -0
  50. data/spec/whois/server_spec.rb +11 -2
  51. data/whois.gemspec +3 -3
  52. metadata +5 -2
@@ -211,12 +211,12 @@ module Whois
211
211
  # is(:response_throttled?)
212
212
  # # => true
213
213
  #
214
- # @api internal
214
+ # @api private
215
215
  def is(symbol)
216
216
  respond_to?(symbol) && send(symbol)
217
217
  end
218
218
 
219
- # @api internal
219
+ # @api private
220
220
  def validate!
221
221
  raise ResponseIsThrottled if is(:response_throttled?)
222
222
  raise ResponseIsUnavailable if is(:response_unavailable?)
@@ -365,7 +365,7 @@ module Whois
365
365
 
366
366
  private
367
367
 
368
- # @api internal
368
+ # @api private
369
369
  def typecast(value, type)
370
370
  if Array == type
371
371
  Array.wrap(value)
@@ -374,7 +374,7 @@ module Whois
374
374
  end
375
375
  end
376
376
 
377
- # @api internal
377
+ # @api private
378
378
  def handle_property(property, *args)
379
379
  unless property_supported?(property)
380
380
  return send(:"_property_#{property}", *args)
@@ -15,6 +15,10 @@ module Whois
15
15
  class Parser
16
16
 
17
17
  # Parser for the whois.aero server.
18
+ #
19
+ # @see Whois::Record::Parser::Example
20
+ # The Example parser for the list of all available methods.
21
+ #
18
22
  class WhoisAero < BaseAfilias
19
23
 
20
24
  property_supported :status do
@@ -20,7 +20,7 @@ module Whois
20
20
  # @see Whois::Record::Parser::Example
21
21
  # The Example parser for the list of all available methods.
22
22
  #
23
- # @since 2.6.0
23
+ # @since 2.6.0
24
24
  class WhoisAtiTn < Base
25
25
  include Scanners::Ast
26
26
 
@@ -20,7 +20,7 @@ module Whois
20
20
  # @see Whois::Record::Parser::Example
21
21
  # The Example parser for the list of all available methods.
22
22
  #
23
- # @since 2.5.0
23
+ # @since 2.5.0
24
24
  class WhoisAudnsNetAu < Base
25
25
  include Scanners::Ast
26
26
 
@@ -20,7 +20,7 @@ module Whois
20
20
  # @see Whois::Record::Parser::Example
21
21
  # The Example parser for the list of all available methods.
22
22
  #
23
- # @since 2.5.0
23
+ # @since 2.5.0
24
24
  class WhoisCiraCa < Base
25
25
  include Scanners::Ast
26
26
 
@@ -20,7 +20,7 @@ module Whois
20
20
  # @see Whois::Record::Parser::Example
21
21
  # The Example parser for the list of all available methods.
22
22
  #
23
- # @since 2.4.0
23
+ # @since 2.4.0
24
24
  class WhoisDnsHr < Base
25
25
  include Scanners::Ast
26
26
 
@@ -19,7 +19,7 @@ module Whois
19
19
  # @see Whois::Record::Parser::Example
20
20
  # The Example parser for the list of all available methods.
21
21
  #
22
- # @since 2.4.0
22
+ # @since 2.4.0
23
23
  class WhoisDreamhostCom < Base
24
24
 
25
25
  property_not_supported :status
@@ -23,7 +23,7 @@ module Whois
23
23
  # @see Whois::Record::Parser::Example
24
24
  # The Example parser for the list of all available methods.
25
25
  #
26
- # @since 2.5.0
26
+ # @since 2.5.0
27
27
  class WhoisEnomCom < Base
28
28
 
29
29
  property_not_supported :status
@@ -23,7 +23,7 @@ module Whois
23
23
  # @see Whois::Record::Parser::Example
24
24
  # The Example parser for the list of all available methods.
25
25
  #
26
- # @since 2.4.0
26
+ # @since 2.4.0
27
27
  class WhoisFi < Base
28
28
 
29
29
  property_supported :status do
@@ -20,7 +20,7 @@ module Whois
20
20
  # @see Whois::Record::Parser::Example
21
21
  # The Example parser for the list of all available methods.
22
22
  #
23
- # @since 2.4.0
23
+ # @since 2.4.0
24
24
  class WhoisNc < Base
25
25
  include Scanners::Ast
26
26
 
@@ -20,7 +20,7 @@ module Whois
20
20
  # The Example parser for the list of all available methods.
21
21
  #
22
22
  # @author Andrew Brampton <me@bramp.net>
23
- # @since RELEASE
23
+ # @since 2.6.2
24
24
  class WhoisNetworksolutionsCom < Base
25
25
 
26
26
  property_not_supported :status
@@ -19,7 +19,7 @@ module Whois
19
19
  # @see Whois::Record::Parser::Example
20
20
  # The Example parser for the list of all available methods.
21
21
  #
22
- # @since 2.4.0
22
+ # @since 2.4.0
23
23
  class WhoisNicLk < Base
24
24
 
25
25
  property_not_supported :disclaimer
@@ -20,7 +20,7 @@ module Whois
20
20
  # @see Whois::Record::Parser::Example
21
21
  # The Example parser for the list of all available methods.
22
22
  #
23
- # @since 2.6.0
23
+ # @since 2.6.0
24
24
  class WhoisRegistryOm < Base
25
25
  include Scanners::Ast
26
26
 
@@ -7,64 +7,19 @@
7
7
  #++
8
8
 
9
9
 
10
- require 'whois/record/parser/base'
10
+ require 'whois/record/parser/base_afilias'
11
11
 
12
12
 
13
13
  module Whois
14
14
  class Record
15
15
  class Parser
16
16
 
17
- #
18
- # = whois.registrypro.pro parser
19
- #
20
17
  # Parser for the whois.registrypro.pro server.
18
+ #
19
+ # @see Whois::Record::Parser::Example
20
+ # The Example parser for the list of all available methods.
21
21
  #
22
- # NOTE: This parser is just a stub and provides only a few basic methods
23
- # to check for domain availability and get domain status.
24
- # Please consider to contribute implementing missing methods.
25
- # See WhoisNicIt parser for an explanation of all available methods
26
- # and examples.
27
- #
28
- class WhoisRegistryproPro < Base
29
-
30
- property_supported :status do
31
- content_for_scanner.scan(/Status:(.*?)\n/).flatten
32
- end
33
-
34
- property_supported :available? do
35
- !!(content_for_scanner =~ /No match/)
36
- end
37
-
38
- property_supported :registered? do
39
- !available?
40
- end
41
-
42
-
43
- property_supported :created_on do
44
- if content_for_scanner =~ /Created On:(.*)\n/
45
- Time.parse($1)
46
- end
47
- end
48
-
49
- property_supported :updated_on do
50
- if content_for_scanner =~ /Last Updated On:(.*)\n/
51
- Time.parse($1)
52
- end
53
- end
54
-
55
- property_supported :expires_on do
56
- if content_for_scanner =~ /Expiration Date:(.*)\n/
57
- Time.parse($1)
58
- end
59
- end
60
-
61
-
62
- property_supported :nameservers do
63
- content_for_scanner.scan(/Name Server:(.+)\n/).flatten.map do |name|
64
- Record::Nameserver.new(:name => name.downcase)
65
- end
66
- end
67
-
22
+ class WhoisRegistryproPro < BaseAfilias
68
23
  end
69
24
 
70
25
  end
@@ -20,7 +20,7 @@ module Whois
20
20
  # @see Whois::Record::Parser::Example
21
21
  # The Example parser for the list of all available methods.
22
22
  #
23
- # @since 2.4.0
23
+ # @since 2.4.0
24
24
  class WhoisRnidsRs < Base
25
25
  include Scanners::Ast
26
26
 
@@ -20,7 +20,7 @@ module Whois
20
20
  # @see Whois::Record::Parser::Example
21
21
  # The Example parser for the list of all available methods.
22
22
  #
23
- # @since RELEASE
23
+ # @since 2.6.2
24
24
  class WhoisSx < Base
25
25
  include Scanners::Ast
26
26
 
@@ -16,7 +16,7 @@ module Whois
16
16
 
17
17
  # Parser for the whois.ua server.
18
18
  #
19
- # @since 2.4.0
19
+ # @since 2.4.0
20
20
  class WhoisUa < Base
21
21
 
22
22
  property_supported :domain do
@@ -58,7 +58,7 @@ module Whois
58
58
  property_supported :created_on do
59
59
  if content_for_scanner =~ /created:\s+(.+)\n/
60
60
  time = $1.split(" ").last
61
- Time.parse(time)
61
+ Time.parse(time) unless time =~ /\A[0]+\z/
62
62
  end
63
63
  end
64
64
 
@@ -16,7 +16,7 @@ module Whois
16
16
 
17
17
  # Scanner for the whois.ati.tn record.
18
18
  #
19
- # @since 2.6.0
19
+ # @since 2.6.0
20
20
  class WhoisAtiTn < Base
21
21
 
22
22
  self.tokenizers += [
@@ -16,7 +16,7 @@ module Whois
16
16
 
17
17
  # Scanner for the whois.audns.net.au record.
18
18
  #
19
- # @since 2.5.0
19
+ # @since 2.5.0
20
20
  class WhoisAudnsNetAu < Base
21
21
 
22
22
  self.tokenizers += [
@@ -16,7 +16,7 @@ module Whois
16
16
 
17
17
  # Scanner for the whois.centralnic.com record.
18
18
  #
19
- # @since 2.3.0
19
+ # @since 2.3.0
20
20
  class WhoisCentralnicCom < Base
21
21
 
22
22
  self.tokenizers += [
@@ -16,7 +16,7 @@ module Whois
16
16
 
17
17
  # Scanner for the whois.cira.ca record.
18
18
  #
19
- # @since 2.5.0
19
+ # @since 2.5.0
20
20
  class WhoisCiraCa < Base
21
21
 
22
22
  self.tokenizers += [
@@ -16,7 +16,7 @@ module Whois
16
16
 
17
17
  # Scanner for the whois.dns.hr record.
18
18
  #
19
- # @since 2.4.0
19
+ # @since 2.4.0
20
20
  class WhoisDnsHr < Base
21
21
 
22
22
  self.tokenizers += [
@@ -16,7 +16,7 @@ module Whois
16
16
 
17
17
  # Scanner for the whois.nc record.
18
18
  #
19
- # @since 2.4.0
19
+ # @since 2.4.0
20
20
  class WhoisNc < Base
21
21
 
22
22
  self.tokenizers += [
@@ -16,7 +16,7 @@ module Whois
16
16
 
17
17
  # Scanner for the whois.registry.om record.
18
18
  #
19
- # @since 2.6.0
19
+ # @since 2.6.0
20
20
  class WhoisRegistryOm < Base
21
21
 
22
22
  self.tokenizers += [
@@ -16,7 +16,7 @@ module Whois
16
16
 
17
17
  # Scanner for the whois.rnids.rs record.
18
18
  #
19
- # @since 2.4.0
19
+ # @since 2.4.0
20
20
  class WhoisRnidsRs < Base
21
21
 
22
22
  self.tokenizers += [
@@ -16,7 +16,7 @@ module Whois
16
16
 
17
17
  # Scanner for the whois.sx record.
18
18
  #
19
- # @since RELEASE
19
+ # @since 2.6.2
20
20
  class WhoisSx < Base
21
21
 
22
22
  self.tokenizers += [
data/lib/whois/server.rb CHANGED
@@ -239,12 +239,16 @@ module Whois
239
239
 
240
240
 
241
241
  def self.find_for_ip(string)
242
- ip = IPAddr.new(string)
243
- type = ip.ipv4? ? :ipv4 : :ipv6
244
- definitions(type).each do |definition|
245
- if IPAddr.new(definition.first).include?(ip)
246
- return factory(type, *definition)
242
+ begin
243
+ ip = IPAddr.new(string)
244
+ type = ip.ipv4? ? :ipv4 : :ipv6
245
+ definitions(type).each do |definition|
246
+ if IPAddr.new(definition.first).include?(ip)
247
+ return factory(type, *definition)
248
+ end
247
249
  end
250
+ rescue ArgumentError => error
251
+ # continue
248
252
  end
249
253
  raise AllocationUnknown, "IP Allocation for `#{string}' unknown. Server definitions might be outdated."
250
254
  end
@@ -44,7 +44,7 @@ module Whois
44
44
 
45
45
  # Temporary internal response buffer.
46
46
  #
47
- # @api internal
47
+ # @api private
48
48
  # @return [Array]
49
49
  attr_reader :buffer
50
50
 
@@ -144,7 +144,7 @@ module Whois
144
144
  @buffer << Whois::Record::Part.new(:body => body, :host => host)
145
145
  end
146
146
 
147
- # @api internal
147
+ # @api private
148
148
  def buffer_start
149
149
  @buffer = []
150
150
  result = yield(@buffer)
@@ -184,7 +184,7 @@ module Whois
184
184
  #
185
185
  # This is for internal use only!
186
186
  #
187
- # @api internal
187
+ # @api private
188
188
  def ask_the_socket(query, *args)
189
189
  client = TCPSocket.new(*args)
190
190
  client.write("#{query}\r\n") # I could use put(foo) and forget the \n
data/lib/whois/version.rb CHANGED
@@ -13,7 +13,7 @@ module Whois
13
13
  module Version
14
14
  MAJOR = 2
15
15
  MINOR = 6
16
- PATCH = 2
16
+ PATCH = 3
17
17
  BUILD = nil
18
18
 
19
19
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join(".")
@@ -49,52 +49,52 @@
49
49
  should: %s CLASS(array)
50
50
  should: %s SIZE(1)
51
51
  should: %s[0] CLASS(contact)
52
- should: %s[0].type == Whois::Record::Contact::TYPE_REGISTRANT
53
- should: %s[0].id == "C4526901-AERO"
54
- should: %s[0].name == "Domain Name Administrator"
55
- should: %s[0].organization == "SriLankan Airlines Ltd"
56
- should: %s[0].address == "Admin Bldg"
57
- should: %s[0].city == "Katunayaka"
58
- should: %s[0].zip == "11450"
59
- should: %s[0].state == "WP"
60
- should: %s[0].country_code == "LK"
61
- should: %s[0].phone == "+94.197331600"
62
- should: %s[0].fax == "+94.197335160"
63
- should: %s[0].email == "domregister@srilankan.aero"
52
+ should: %s[0].type == Whois::Record::Contact::TYPE_REGISTRANT
53
+ should: %s[0].id == "C4526901-AERO"
54
+ should: %s[0].name == "Domain Name Administrator"
55
+ should: %s[0].organization == "SriLankan Airlines Ltd"
56
+ should: %s[0].address == "Admin Bldg"
57
+ should: %s[0].city == "Katunayaka"
58
+ should: %s[0].zip == "11450"
59
+ should: %s[0].state == "WP"
60
+ should: %s[0].country_code == "LK"
61
+ should: %s[0].phone == "+94.197331600"
62
+ should: %s[0].fax == "+94.197335160"
63
+ should: %s[0].email == "domregister@srilankan.aero"
64
64
 
65
65
  #admin_contacts
66
66
  should: %s CLASS(array)
67
67
  should: %s SIZE(1)
68
68
  should: %s[0] CLASS(contact)
69
- should: %s[0].type == Whois::Record::Contact::TYPE_ADMIN
70
- should: %s[0].id == "C4526901-AERO"
71
- should: %s[0].name == "Domain Name Administrator"
72
- should: %s[0].organization == "SriLankan Airlines Ltd"
73
- should: %s[0].address == "Admin Bldg"
74
- should: %s[0].city == "Katunayaka"
75
- should: %s[0].zip == "11450"
76
- should: %s[0].state == "WP"
77
- should: %s[0].country_code == "LK"
78
- should: %s[0].phone == "+94.197331600"
79
- should: %s[0].fax == "+94.197335160"
80
- should: %s[0].email == "domregister@srilankan.aero"
69
+ should: %s[0].type == Whois::Record::Contact::TYPE_ADMIN
70
+ should: %s[0].id == "C4526901-AERO"
71
+ should: %s[0].name == "Domain Name Administrator"
72
+ should: %s[0].organization == "SriLankan Airlines Ltd"
73
+ should: %s[0].address == "Admin Bldg"
74
+ should: %s[0].city == "Katunayaka"
75
+ should: %s[0].zip == "11450"
76
+ should: %s[0].state == "WP"
77
+ should: %s[0].country_code == "LK"
78
+ should: %s[0].phone == "+94.197331600"
79
+ should: %s[0].fax == "+94.197335160"
80
+ should: %s[0].email == "domregister@srilankan.aero"
81
81
 
82
82
  #technical_contacts
83
83
  should: %s CLASS(array)
84
84
  should: %s SIZE(1)
85
85
  should: %s[0] CLASS(contact)
86
- should: %s[0].type == Whois::Record::Contact::TYPE_TECHNICAL
87
- should: %s[0].id == "C4526901-AERO"
88
- should: %s[0].name == "Domain Name Administrator"
89
- should: %s[0].organization == "SriLankan Airlines Ltd"
90
- should: %s[0].address == "Admin Bldg"
91
- should: %s[0].city == "Katunayaka"
92
- should: %s[0].zip == "11450"
93
- should: %s[0].state == "WP"
94
- should: %s[0].country_code == "LK"
95
- should: %s[0].phone == "+94.197331600"
96
- should: %s[0].fax == "+94.197335160"
97
- should: %s[0].email == "domregister@srilankan.aero"
86
+ should: %s[0].type == Whois::Record::Contact::TYPE_TECHNICAL
87
+ should: %s[0].id == "C4526901-AERO"
88
+ should: %s[0].name == "Domain Name Administrator"
89
+ should: %s[0].organization == "SriLankan Airlines Ltd"
90
+ should: %s[0].address == "Admin Bldg"
91
+ should: %s[0].city == "Katunayaka"
92
+ should: %s[0].zip == "11450"
93
+ should: %s[0].state == "WP"
94
+ should: %s[0].country_code == "LK"
95
+ should: %s[0].phone == "+94.197331600"
96
+ should: %s[0].fax == "+94.197335160"
97
+ should: %s[0].email == "domregister@srilankan.aero"
98
98
 
99
99
 
100
100
  #nameservers