class Capybara::Server::Checker

def http_request(&block)

def http_request(&block)
  make_request(read_timeout: 2, &block)
end

def https_request(&block)

def https_request(&block)
  make_request(**ssl_options, &block)
end

def initialize(host, port)

def initialize(host, port)
  @host, @port = host, port
  @ssl = false
end

def make_request(**options, &block)

def make_request(**options, &block)
  Net::HTTP.start(@host, @port, options.merge(max_retries: 0), &block)
end

def request(&block)

def request(&block)
  ssl? ? https_request(&block) : http_request(&block)
rescue *TRY_HTTPS_ERRORS
  res = https_request(&block)
  @ssl = true
  res
end

def ssl?

def ssl?
  @ssl
end

def ssl_options

def ssl_options
  { use_ssl: true, verify_mode: OpenSSL::SSL::VERIFY_NONE }
end