Permalink
Browse files

Merge pull request #220 from linrock/arin-query-format

Send additional parameters for ARIN queries (fixes #10).
  • Loading branch information...
weppos committed Apr 4, 2013
2 parents be9b769 + dd01661 commit cbb2e73ad6bba8e4d3e72eb51de8534e1483aed2
Showing with 9 additions and 8 deletions.
  1. +1 −0 lib/whois/server/adapters/arin.rb
  2. +8 −8 spec/whois/server/adapters/arin_spec.rb
@@ -26,6 +26,7 @@ class Arin < Base
# @return [void]
#
def request(string)
+ string = "n + #{string}"
response = query_the_socket(string, host)
buffer_append response, host
@@ -10,7 +10,7 @@
it "returns the WHOIS record" do
response = "Whois Response"
expected = response
- server.query_handler.expects(:call).with("0.0.0.0", "whois.arin.net", 43).returns(response)
+ server.query_handler.expects(:call).with("n + 0.0.0.0", "whois.arin.net", 43).returns(response)
record = server.lookup("0.0.0.0")
record.to_s.should == expected
record.parts.should have(1).part
@@ -23,8 +23,8 @@
referral = File.read(fixture("referrals/arin_referral_whois.txt"))
response = "Whois Response"
expected = referral + "\n" + response
- server.query_handler.expects(:call).with("0.0.0.0", "whois.arin.net", 43).returns(referral)
- server.query_handler.expects(:call).with("0.0.0.0", "whois.ripe.net", 43).returns(response)
+ server.query_handler.expects(:call).with("n + 0.0.0.0", "whois.arin.net", 43).returns(referral)
+ server.query_handler.expects(:call).with("n + 0.0.0.0", "whois.ripe.net", 43).returns(response)
record = server.lookup("0.0.0.0")
record.to_s.should == expected
@@ -37,8 +37,8 @@
referral = File.read(fixture("referrals/arin_referral_rwhois.txt"))
response = "Whois Response"
expected = referral + "\n" + response
- server.query_handler.expects(:call).with("0.0.0.0", "whois.arin.net", 43).returns(referral)
- server.query_handler.expects(:call).with("0.0.0.0", "rwhois.servernap.net", 4321).returns(response)
+ server.query_handler.expects(:call).with("n + 0.0.0.0", "whois.arin.net", 43).returns(referral)
+ server.query_handler.expects(:call).with("n + 0.0.0.0", "rwhois.servernap.net", 4321).returns(response)
record = server.lookup("0.0.0.0")
record.to_s.should == expected
@@ -50,16 +50,16 @@
it "ignores referral if options[:referral] is false" do
referral = File.read(fixture("referrals/arin_referral_whois.txt"))
server.options[:referral] = false
- server.query_handler.expects(:call).with("0.0.0.0", "whois.arin.net", 43).returns(referral)
- server.query_handler.expects(:call).with("0.0.0.0", "whois.ripe.net", 43).never
+ server.query_handler.expects(:call).with("n + 0.0.0.0", "whois.arin.net", 43).returns(referral)
+ server.query_handler.expects(:call).with("n + 0.0.0.0", "whois.ripe.net", 43).never
record = server.lookup("0.0.0.0")
record.parts.should have(1).part
end
it "ignores referral (gracefully) if missing" do
referral = File.read(fixture("referrals/arin_referral_missing.txt"))
- server.query_handler.expects(:call).with("0.0.0.0", "whois.arin.net", 43).returns(referral)
+ server.query_handler.expects(:call).with("n + 0.0.0.0", "whois.arin.net", 43).returns(referral)
server.query_handler.expects(:call).never
record = server.lookup("0.0.0.0")

0 comments on commit cbb2e73

Please sign in to comment.