lib/vra/http.rb in vmware-vra-1.6.1 vs lib/vra/http.rb in vmware-vra-1.7.0
- old
+ new
@@ -34,12 +34,14 @@
end
def call
uri = URI(params[:url]) || fail(':url required')
- Net::HTTP.start(uri.host, uri.port,
- use_ssl: uri.scheme == 'https') do |http|
+ ssl_params = { use_ssl: uri.scheme == 'https' }
+ ssl_params[:verify_mode] = OpenSSL::SSL::VERIFY_NONE unless verify_ssl?
+
+ Net::HTTP.start(uri.host, uri.port, ssl_params) do |http|
request = http_request(params[:method], uri)
request.initialize_http_header(params[:headers] || {})
request.body = params[:payload] || ''
Response.new(http.request(request))
@@ -60,9 +62,14 @@
protected
def new(new_params)
self.class.new(params.dup.merge(new_params))
+ end
+
+ def verify_ssl?
+ return true if params[:verify_ssl].nil?
+ params[:verify_ssl]
end
end
class Response
# For hiding the details of the HTTP response class