New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Send additional parameters for ARIN queries (fixes #10). #220
Conversation
Hmm, I'll have to update the tests to account for this. |
@@ -26,6 +26,7 @@ class Arin < Base | |||
# @return [void] | |||
# | |||
def request(string) | |||
string = "+ z #{string}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless you need it later, I would suggest to pass the modified string directly to the method call.
response = query_the_socket("+ z #{string}", host)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense - I changed it.
I changed the parameters being sent to "n +" just to be consistent with debian whois. |
Good idea! 👏 |
buffer_append response, host | ||
|
||
if options[:referral] != false && (referral = extract_referral(response)) | ||
response = query_the_socket(string, referral[:host], referral[:port]) | ||
response = query_the_socket("n + #{string}", referral[:host], referral[:port]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I didn't notice it was used twice. In this case I would suggest
def request(string)
query = "n + #{string}"
Then you can use the query
variable. The reason for this, is that I normally tend to avoid replacing the argument (that's the reason why I didn't like string = "n + #{string}"
)
Sorry for the back and forth.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha it's alright. Updated again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, sorry I misread about using the query
variable. I don't normally have a preference, but I'll be mindful next time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't worry, it's fine. If all the patches requests would be like this
would be a wonderful world.
Thanks again!
On Thu, Apr 4, 2013 at 12:36 PM, Linmiao Xu notifications@github.comwrote:
In lib/whois/server/adapters/arin.rb:
buffer_append response, host if options[:referral] != false && (referral = extract_referral(response))
response = query_the_socket(string, referral[:host], referral[:port])
response = query_the_socket("n + #{string}", referral[:host], referral[:port])
Oops, sorry I misread about using the query variable. I don't normally
have a preference, but I'll be mindful next time.—
Reply to this email directly or view it on GitHubhttps://github.com//pull/220/files#r3652781
.
Simone Carletti
Passionate programmer and dive instructor
http://www.simonecarletti.com/
Twitter: @weppos https://twitter.com/weppos - Facebook: simone.io
Send additional parameters for ARIN queries (fixes #10).
Without sending additional parameters, ARIN sometimes doesn't return a full response (see #10). For example:
Sending "n +" as the query parameters should give a full response. Here's the same query, but prepending "n +":
From the ARIN help info: