lib/faraday/adapter/net_http.rb in faraday-net_http-1.0.2 vs lib/faraday/adapter/net_http.rb in faraday-net_http-2.0.0.alpha.pre.1
- old
+ new
@@ -39,11 +39,12 @@
super(app, opts, &block)
end
def build_connection(env)
net_http_connection(env).tap do |http|
- configure_ssl(http, env[:ssl]) if env[:url].scheme == 'https' && env[:ssl]
+ http.use_ssl = env[:url].scheme == 'https' if http.respond_to?(:use_ssl=)
+ configure_ssl(http, env[:ssl])
configure_request(http, env[:request])
end
end
def net_http_connection(env)
@@ -152,10 +153,10 @@
end
end
end
def configure_ssl(http, ssl)
- http.use_ssl = true if http.respond_to?(:use_ssl=)
+ return unless ssl
http.verify_mode = ssl_verify_mode(ssl)
http.cert_store = ssl_cert_store(ssl)
http.cert = ssl[:client_cert] if ssl[:client_cert]