Detect throttled responses #61

Closed
groe opened this Issue Dec 8, 2010 · 5 comments

Comments

Projects
None yet
2 participants

groe commented Dec 8, 2010

Although there is a method "throttle?" in the Parser base class it seems like there are no (working) implementations of the expected behaviour. Also, the "available?" method returns "true" in case of throttled responses - so distinguishing between Whois-responses that say "Okay this domain is available" and those who say "You exceeded the daily limit, maybe the domain is available - maybe it´s not" is not possible.

One example for a Whois-request on a .net-Domain:
whoisClient = Whois::Client.new(:timeout => 60)
whois = whoisClient.query("lincolninterfaith.org")

puts whois
whois.properties.each {|a,b| puts "#{a} = #{b}"}
puts "throtte=#{whois.throttle? ? "1" : "0"}"

Running this code I get outputs like this:
WHOIS LIMIT EXCEEDED - SEE WWW.PIR.ORG/WHOIS FOR DETAILS
status =
domain_id =
registrar =
referral_whois =
registrant_contact =
referral_url =
admin_contact =
created_on =
technical_contact =
registered? = false
disclaimer =
updated_on =
nameservers =
available? = true
domain =
expires_on =
throtte=0

And sometimes even a RuntimeError is thrown
WHOIS LIMI
/usr/lib/ruby/gems/1.8/gems/whois-1.6.4/lib/whois/answer/parser/whois.publicinterestregistry.net.rb:184:in error': Unexpected token:WHOIS LIMI' (RuntimeError)
from /usr/lib/ruby/gems/1.8/gems/whois-1.6.4/lib/whois/answer/parser/whois.publicinterestregistry.net.rb:173:in parse_content' from /usr/lib/ruby/gems/1.8/gems/whois-1.6.4/lib/whois/answer/parser/whois.publicinterestregistry.net.rb:159:inparse'
from /usr/lib/ruby/gems/1.8/gems/whois-1.6.4/lib/whois/answer/parser/whois.publicinterestregistry.net.rb:125:in parse' from /usr/lib/ruby/gems/1.8/gems/whois-1.6.4/lib/whois/answer/parser/ast.rb:51:inast'
from /usr/lib/ruby/gems/1.8/gems/whois-1.6.4/lib/whois/answer/parser/ast.rb:60:in node' from /usr/lib/ruby/gems/1.8/gems/whois-1.6.4/lib/whois/answer/parser/whois.publicinterestregistry.net.rb:33:indisclaimer'
from /usr/lib/ruby/gems/1.8/gems/whois-1.6.4/lib/whois/answer/parser.rb:90:in send' from /usr/lib/ruby/gems/1.8/gems/whois-1.6.4/lib/whois/answer/parser.rb:90:indelegate_to_parsers'
from /usr/lib/ruby/gems/1.8/gems/whois-1.6.4/lib/whois/answer/parser.rb:74:in method_missing' from /usr/lib/ruby/gems/1.8/gems/whois-1.6.4/lib/whois/answer.rb:172:indisclaimer'
from /usr/lib/ruby/gems/1.8/gems/whois-1.6.4/lib/whois/answer.rb:178:in send' from /usr/lib/ruby/gems/1.8/gems/whois-1.6.4/lib/whois/answer.rb:178:inmethod_missing'
from /usr/lib/ruby/gems/1.8/gems/whois-1.6.4/lib/whois/answer.rb:143:in send' from /usr/lib/ruby/gems/1.8/gems/whois-1.6.4/lib/whois/answer.rb:143:inproperties'
from /usr/lib/ruby/gems/1.8/gems/whois-1.6.4/lib/whois/answer.rb:143:in each' from /usr/lib/ruby/gems/1.8/gems/whois-1.6.4/lib/whois/answer.rb:143:inproperties'

Another example response for a .NL-domain (google.nl):
whois.domain-registry.nl: daily whois-limit exceeded for client <my_ip_address>
status = available
domain_id =
registrar =
referral_whois =
registrant_contact =
referral_url =
admin_contact =
created_on =
technical_contact =
registered? = false
disclaimer =
updated_on =
nameservers =
available? = true
domain =
expires_on =
throtte=0

Would be great if there was a way to check whether a response was throttled or not (or maybe just change the default value of "available?" to "nil"?).

Regards,
groe

groe commented Feb 9, 2011

Still wears no label. Any news regarding that issue?

Owner

weppos commented Feb 13, 2011

See also #54.

The current master version contains a valid implementation of #throttle?.
However, the feature still has to be finalized.

Owner

weppos commented Feb 19, 2011

Added support for throttled response detection (closed by f24dd51, closed by f24dd51, closed by f24dd51)

groe commented Mar 11, 2011

Great, thank you very much! :)
When can we expect this fix included at RubyGems?

Owner

weppos commented Mar 12, 2011

It will be part of Whois 2.0. I plan to release the gem someday before the end of March.

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment