bin/check-http.rb in sensu-plugins-http-0.2.0 vs bin/check-http.rb in sensu-plugins-http-0.2.1
- old
+ new
@@ -195,10 +195,13 @@
if config[:no_proxy]
http = Net::HTTP.new(config[:host], config[:port], nil, nil)
elsif config[:proxy_url]
proxy_uri = URI.parse(config[:proxy_url])
+ if proxy_uri.host.nil?
+ unknown 'Invalid proxy url specified'
+ end
http = Net::HTTP.new(config[:host], config[:port], proxy_uri.host, proxy_uri.port)
else
http = Net::HTTP.new(config[:host], config[:port])
end
http.read_timeout = config[:timeout]
@@ -217,13 +220,15 @@
http.verify_mode = OpenSSL::SSL::VERIFY_NONE if config[:insecure]
unless config[:expiry].nil?
expire_warn_date = Time.now + (config[:expiry] * 60 * 60 * 24)
# We can't raise inside the callback, have to check when we finish.
- http.verify_callback = proc do |_preverify_ok, ssl_context|
+ http.verify_callback = proc do |preverify_ok, ssl_context|
if ssl_context.current_cert.not_after <= expire_warn_date
warn_cert_expire = ssl_context.current_cert.not_after
end
+
+ preverify_ok
end
end
end
req = Net::HTTP::Get.new(config[:request_uri], 'User-Agent' => config[:ua])