Sha256: 05187a7e6275579dd6b80a3f353a49b6d7c3ce394f9714b6d33f4df00aee54e2
Contents?: true
Size: 886 Bytes
Versions: 2
Compression:
Stored size: 886 Bytes
Contents
# frozen_string_literal: true 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 end def request(&block) ssl? ? https_request(&block) : http_request(&block) rescue *TRY_HTTPS_ERRORS # rubocop:disable Naming/RescuedExceptionsVariableName res = https_request(&block) @ssl = true res end def ssl? @ssl end private def http_request(&block) Net::HTTP.start(@host, @port, read_timeout: 2, &block) end def https_request(&block) Net::HTTP.start(@host, @port, ssl_options, &block) end def ssl_options { use_ssl: true, verify_mode: OpenSSL::SSL::VERIFY_NONE } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
capybara-3.18.0 | lib/capybara/server/checker.rb |
capybara-3.17.0 | lib/capybara/server/checker.rb |