diff --git a/bin/check-http.rb b/bin/check-http.rb index 2d931ba..cda472b 100755 --- a/bin/check-http.rb +++ b/bin/check-http.rb @@ -59,6 +59,7 @@ require 'net/http' require 'net/https' require 'digest' +require 'resolv-replace' # # Check HTTP @@ -262,6 +263,11 @@ def run config[:port] ||= config[:ssl] ? 443 : 80 end + # Use Ruby DNS Resolver and set DNS resolution timeout to 800ms + dns_resolver = Resolv::DNS.new + dns_resolver.timeouts = 0.8 + Resolv::DefaultResolver.replace_resolvers([dns_resolver]) + begin Timeout.timeout(config[:timeout]) do acquire_resource