Add Errno::ECONNRESET to the errors that trigger https attempt

This commit is contained in:
Thomas Walpole 2018-09-20 08:56:35 -07:00
parent 7f4b960115
commit 449f0ae47d
1 changed files with 3 additions and 1 deletions

View File

@ -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