Sha256: ebc333e19d2892aa2eed837df4290f4e350526c9b7f678e66fadf03f929cf294
Contents?: true
Size: 1.89 KB
Versions: 1
Compression:
Stored size: 1.89 KB
Contents
require "net/https" module Selenium module WebDriver module Remote module Http # @private class Default < Common private def http # ignoring SSL for now @http ||= ( http = Net::HTTP.new @server_url.host, @server_url.port if @server_url.scheme == "https" http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE end if self.class.timeout http.open_timeout = self.class.timeout http.read_timeout = self.class.timeout end http ) end def request(verb, url, headers, payload, redirects = 0) request = new_request_for(verb, url, headers) retried = false begin response = http.request(request, payload) rescue Errno::ECONNABORTED, Errno::ECONNRESET # this happens sometimes on windows?! raise if retried request = new_request_for(verb, url, headers) retried = true retry end if response.kind_of? Net::HTTPRedirection raise Error::WebDriverError, "too many redirects" if redirects >= MAX_REDIRECTS request(:get, URI.parse(response['Location']), DEFAULT_HEADERS.dup, nil, redirects + 1) else create_response response.code, response.body, response.content_type end end def new_request_for(verb, url, headers) req = Net::HTTP.const_get(verb.to_s.capitalize).new(url.path, headers) if @server_url.userinfo req.basic_auth @server_url.user, @server_url.password end req end end # Default end # Http end # Remote end # WebDriver end # Selenium
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
selenium-webdriver-0.1.0 | lib/selenium/webdriver/remote/http/default.rb |