Merge branch 'em-http-proxy-failure'

This commit is contained in:
Mislav Marohnić 2015-10-02 01:12:25 +02:00
commit 033e7b420d
3 changed files with 10 additions and 1 deletions

View File

@ -70,6 +70,12 @@ module Faraday
else else
raise Error::ConnectionFailed, err raise Error::ConnectionFailed, err
end end
rescue RuntimeError => err
if err.message == "connection closed by server"
raise Error::ConnectionFailed, err
else
raise
end
rescue => err rescue => err
if defined?(OpenSSL) && OpenSSL::SSL::SSLError === err if defined?(OpenSSL) && OpenSSL::SSL::SSLError === err
raise Faraday::SSLError, err raise Faraday::SSLError, err

View File

@ -132,6 +132,7 @@ if [ -n "$(filter_matching "adapters" "${test_files[@]}")" ]; then
cleanup() { cleanup() {
if [ $? -ne 0 ] && [ -n "$TRAVIS" ]; then if [ $? -ne 0 ] && [ -n "$TRAVIS" ]; then
cat log/test.log cat log/test.log
cat log/proxy.log
fi fi
kill "$server_pid" kill "$server_pid"
kill "$proxy_pid" kill "$proxy_pid"

View File

@ -207,8 +207,10 @@ module Adapters
conn.get '/echo' conn.get '/echo'
end end
unless self.class.ssl_mode? && self.class.jruby? unless self.class.ssl_mode? && (self.class.jruby? ||
adapter == :em_http || adapter == :em_synchrony)
# JRuby raises "End of file reached" which cannot be distinguished from a 407 # JRuby raises "End of file reached" which cannot be distinguished from a 407
# EM raises "connection closed by server" due to https://github.com/igrigorik/em-socksify/pull/19
assert_equal %{407 "Proxy Authentication Required "}, err.message assert_equal %{407 "Proxy Authentication Required "}, err.message
end end
end end