From da757889a95963e7e4e25708a675728c4cbc8ab5 Mon Sep 17 00:00:00 2001 From: Alexey Lapitsky Date: Sat, 4 May 2013 23:43:23 +0200 Subject: [PATCH] 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 --- drivers/ruby/wappalyzer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ruby/wappalyzer.rb b/drivers/ruby/wappalyzer.rb index a09d216da..f7e0f163e 100755 --- a/drivers/ruby/wappalyzer.rb +++ b/drivers/ruby/wappalyzer.rb @@ -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)