Hi. I''ve read about using request.remote_ip to resolve an IP from an incoming request. Is there a similar way to resolve the hostname from an incoming request or do I need to use the IP in combination with some other library? Best regards and many thanks, gustav -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You''d need to use another library. On Dec 11, 2007 10:34 AM, Gustav Stockholm <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hi. I''ve read about using request.remote_ip to resolve an IP from an > incoming request. Is there a similar way to resolve the hostname from an > incoming request or do I need to use the IP in combination with some > other library? > > Best regards and many thanks, > gustav > -- > Posted via http://www.ruby-forum.com/. > > > >-- Ryan Bigg http://www.frozenplague.net --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
That''s something I didn''t know. Interesting to know this, thanks! On Dec 11, 2007 1:16 PM, Philip Hallstrom <rails-SUcgGwS4C16SUMMaM/qcSw@public.gmane.org> wrote:> > >> Hi. I''ve read about using request.remote_ip to resolve an IP from an > >> incoming request. Is there a similar way to resolve the hostname from > an > >> incoming request or do I need to use the IP in combination with some > >> other library? > > irb(main):001:0> require ''resolv'' > => true > irb(main):002:0> Resolv.getname(''72.36.232.219'') > => "bravo.pjkh.com" > > It''s going to slow your site down however... DNS can take some time... you > may want to cache the data locally or look into having a very close > caching nameserver, etc. > > > >-- Ryan Bigg http://www.frozenplague.net --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
>> Hi. I''ve read about using request.remote_ip to resolve an IP from an >> incoming request. Is there a similar way to resolve the hostname from an >> incoming request or do I need to use the IP in combination with some >> other library?irb(main):001:0> require ''resolv'' => true irb(main):002:0> Resolv.getname(''72.36.232.219'') => "bravo.pjkh.com" It''s going to slow your site down however... DNS can take some time... you may want to cache the data locally or look into having a very close caching nameserver, etc. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ryan Bigg wrote:> You''d need to use another library.Ok. You think the Ruby Socket-library will do? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---