6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/occi/api/client/http/httparty_fix.rb', line 6
def attach_ssl_certificates(http, options)
if http.use_ssl?
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
if options[:pem]
http.cert = OpenSSL::X509::Certificate.new(options[:pem])
http.key = OpenSSL::PKey::RSA.new(options[:pem], options[:pem_password])
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
end
if options[:ssl_extra_chain_cert]
http. = []
options[:ssl_extra_chain_cert].each do |p_ca|
http. << OpenSSL::X509::Certificate.new(p_ca)
end
end
if options[:ssl_ca_file]
http.ca_file = options[:ssl_ca_file]
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
end
if options[:ssl_ca_path]
http.ca_path = options[:ssl_ca_path]
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
end
if options[:ssl_version] && http.respond_to?(:ssl_version=)
http.ssl_version = options[:ssl_version]
end
end
end
|