lib/faraday/adapter/net_http.rb in faraday-0.8.9 vs lib/faraday/adapter/net_http.rb in faraday-0.8.10
- old
+ new
@@ -22,10 +22,11 @@
SocketError,
Zlib::GzipFile::Error,
]
NET_HTTP_EXCEPTIONS << OpenSSL::SSL::SSLError if defined?(OpenSSL)
+ NET_HTTP_EXCEPTIONS << Net::OpenTimeout if defined?(Net::OpenTimeout)
def call(env)
super
http = net_http_connection(env)
configure_ssl(http, env[:ssl]) if env[:url].scheme == 'https' and env[:ssl]
@@ -79,10 +80,10 @@
def net_http_connection(env)
if proxy = env[:request][:proxy]
Net::HTTP::Proxy(proxy[:uri].host, proxy[:uri].port, proxy[:user], proxy[:password])
else
Net::HTTP
- end.new(env[:url].host, env[:url].port)
+ end.new(env[:url].host, env[:url].port || (env[:url].scheme == 'https' ? 443 : 80))
end
def configure_ssl(http, ssl)
http.use_ssl = true
http.verify_mode = ssl_verify_mode(ssl)