Add open timeout for the ruby driver

On linux if tcp connection can't be opened and there is no reply
because traffic is filtered or the host is down, it takes 127
seconds to timeout by default: 6 syn retries (63s) + 64s of waiting
main
Alexey Lapitsky 12 years ago
parent 4ceb14f41a
commit da757889a9

@ -14,7 +14,7 @@ class Wappalyzer
def analyze(url)
uri, body, headers = URI(url), nil, {}
Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https', :open_timeout => 5) do |http|
resp = http.get(uri.request_uri)
resp.canonical_each{|k,v| headers[k] = v}
body = resp.body.encode('UTF-8', :invalid => :replace, :undef => :replace)