summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormokha <mokha@cisco.com>2018-03-22 09:46:27 -0600
committermokha <mokha@cisco.com>2018-03-22 09:46:27 -0600
commit18d7947e27333304483ed9a06b2cac02363b6d75 (patch)
tree8d7a31e46dc98e16abb68503cf2044b7a17d1546
parent0cf70d571bc67490a5fa95234afeb303f4b396ed (diff)
disable peer verification in debug mode.
-rw-r--r--lib/ats/http_api.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/ats/http_api.rb b/lib/ats/http_api.rb
index 662a4cd..0da1a87 100644
--- a/lib/ats/http_api.rb
+++ b/lib/ats/http_api.rb
@@ -1,3 +1,5 @@
+require 'openssl'
+
module ATS
class HttpAPI
def initialize(headers: {}, debug: false)
@@ -45,7 +47,10 @@ module ATS
http = Net::HTTP.new(uri.host, uri.port)
http.read_timeout = 30
http.use_ssl = uri.scheme == "https"
- http.set_debug_output(ATS.logger) if @debug
+ if debug?
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
+ http.set_debug_output(ATS.logger)
+ end
http
end
@@ -66,5 +71,9 @@ module ATS
x.body = JSON.generate(body)
end
end
+
+ def debug?
+ @debug
+ end
end
end