Class: Capybara::Server::Checker Private
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/capybara/server/checker.rb |
Constant Summary
-
TRY_HTTPS_ERRORS =
# File 'lib/capybara/server/checker.rb', line 6[EOFError, Net::ReadTimeout, Errno::ECONNRESET].freeze
Class Method Summary
- .new(host, port) ⇒ Checker constructor Internal use only
Instance Attribute Summary
- #ssl? ⇒ Boolean readonly Internal use only
Instance Method Summary
- #request(&block) Internal use only
- #http_request(&block) private Internal use only
- #https_request(&block) private Internal use only
- #make_request(**options, &block) private Internal use only
- #ssl_options private Internal use only
Constructor Details
.new(host, port) ⇒ Checker
Instance Attribute Details
#ssl? ⇒ Boolean
(readonly)
# File 'lib/capybara/server/checker.rb', line 21
def ssl? @ssl end
Instance Method Details
#http_request(&block) (private)
[ GitHub ]# File 'lib/capybara/server/checker.rb', line 27
def http_request(&block) make_request(read_timeout: 2, &block) end
#https_request(&block) (private)
[ GitHub ]# File 'lib/capybara/server/checker.rb', line 31
def https_request(&block) make_request(**, &block) end
#make_request(**options, &block) (private)
[ GitHub ]# File 'lib/capybara/server/checker.rb', line 35
def make_request(**, &block) Net::HTTP.start(@host, @port, .merge(max_retries: 0), &block) end
#request(&block)
[ GitHub ]# File 'lib/capybara/server/checker.rb', line 13
def request(&block) ssl? ? https_request(&block) : http_request(&block) rescue *TRY_HTTPS_ERRORS res = https_request(&block) @ssl = true res end
#ssl_options (private)
[ GitHub ]# File 'lib/capybara/server/checker.rb', line 39
def { use_ssl: true, verify_mode: OpenSSL::SSL::VERIFY_NONE } end