correct the logic correction: ssl[:verify_mode]

Previous logic correction (70f3eb3) was in fact a breakage of functionality.
The ssl[:verify_mode] is not a boolean; it's the value that, if present,
should be passed directly to http.verify_mode
This commit is contained in:
Mislav Marohnić 2011-08-09 20:03:57 +02:00
parent a81b61a76f
commit 5dddbfb1fd

View File

@ -16,8 +16,9 @@ module Faraday
http = net_http_class(env).new(url.host, url.inferred_port)
if http.use_ssl = (url.scheme == 'https' && (ssl = env[:ssl]) && true)
http.verify_mode = ssl.key?(:verify_mode) ? (ssl[:verify_mode] ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE) :
ssl.fetch(:verify, true) ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE
http.verify_mode = ssl[:verify_mode] || begin
ssl.fetch(:verify, true) ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE
end
http.cert = ssl[:client_cert] if ssl[:client_cert]
http.key = ssl[:client_key] if ssl[:client_key]
http.ca_file = ssl[:ca_file] if ssl[:ca_file]