]> projects.mako.cc - selectricity/blobdiff - lib/whois/whois.rb
fixed colors on graphs
[selectricity] / lib / whois / whois.rb
index 88c735ba4f4309a0d3746646f4bc5ad731c69263..962a399c9283b4a12d054f0dcc6d2506d91caf23 100755 (executable)
@@ -4,6 +4,8 @@ require 'socket'
 require 'resolv'
 require 'ipaddr'
 require 'yaml'
 require 'resolv'
 require 'ipaddr'
 require 'yaml'
+require 'timeout'
+
 require File.dirname(__FILE__) + '/server/server'
 
 # Module for manage all Whois Class
 require File.dirname(__FILE__) + '/server/server'
 
 # Module for manage all Whois Class
@@ -92,7 +94,11 @@ module Whois
         def search_host
             begin
                 if @host_search
         def search_host
             begin
                 if @host_search
-                    @host = Resolv.getname self.ip.to_s
+                   begin
+                     timeout(5) {@host = Resolv.getname self.ip.to_s}
+                   rescue Timeout::Error
+                     @host=nil
+                   end
                 else
                     @host = nil
                 end
                 else
                     @host = nil
                 end
@@ -124,7 +130,7 @@ module Whois
             if ip_range.include? self.ip and l[1].length > 0
               return Object.instance_eval("Server::#{l[1]}.new")
             end
             if ip_range.include? self.ip and l[1].length > 0
               return Object.instance_eval("Server::#{l[1]}.new")
             end
-            return Server::Ripe.new
+            return Server::Arin.new
           end
         end
 
           end
         end
 
@@ -133,7 +139,7 @@ module Whois
           ipv6_list = YAML::load_file(File.dirname(__FILE__) + '/data/ipv6.yaml')
           server = server_with_hash(ipv6_list)
           unless server.kind_of? Server::Server
           ipv6_list = YAML::load_file(File.dirname(__FILE__) + '/data/ipv6.yaml')
           server = server_with_hash(ipv6_list)
           unless server.kind_of? Server::Server
-            return Server::Ripe.new
+            return Server::Arin.new
           else
             return server
           end
           else
             return server
           end

Benjamin Mako Hill || Want to submit a patch?