diff --git a/lib/capybara/server/checker.rb b/lib/capybara/server/checker.rb index e9285404..7189475b 100644 --- a/lib/capybara/server/checker.rb +++ b/lib/capybara/server/checker.rb @@ -3,6 +3,8 @@ module Capybara class Server class Checker + TRY_HTTPS_ERRORS = [EOFError, Net::ReadTimeout, Errno::ECONNRESET].freeze + def initialize(host, port) @host, @port = host, port @ssl = false @@ -10,7 +12,7 @@ module Capybara def request(&block) ssl? ? https_request(&block) : http_request(&block) - rescue EOFError, Net::ReadTimeout + rescue *TRY_HTTPS_ERRORS res = https_request(&block) @ssl = true res