class Selenium::WebDriver::Remote::Http::Curb
An alternative to the default Net::HTTP client.
This can be used for the Firefox and Remote drivers if you have Curb installed.
@example Using Curb
require 'selenium/webdriver/remote/http/curb' include Selenium driver = WebDriver.for :firefox, :http_client => WebDriver::Remote::Http::Curb.new
Public Instance Methods
quit_errors()
click to toggle source
Calls superclass method
Selenium::WebDriver::Remote::Http::Common#quit_errors
# File lib/selenium/webdriver/remote/http/curb.rb, line 41 def quit_errors [Curl::Err::RecvError] + super end
Private Instance Methods
client()
click to toggle source
# File lib/selenium/webdriver/remote/http/curb.rb, line 80 def client @client ||= begin c = Curl::Easy.new c.max_redirects = MAX_REDIRECTS c.follow_location = true c.timeout = @timeout if @timeout c.verbose = WebDriver.logger.info? c end end
request(verb, url, headers, payload)
click to toggle source
# File lib/selenium/webdriver/remote/http/curb.rb, line 47 def request(verb, url, headers, payload) client.url = url.to_s # workaround for http://github.com/taf2/curb/issues/issue/40 # curb will handle this for us anyway headers.delete 'Content-Length' client.headers = headers # http://github.com/taf2/curb/issues/issue/33 client.head = false client.delete = false case verb when :get client.http_get when :post client.post_body = payload || '' client.http_post when :put client.put_data = payload || '' client.http_put when :delete client.http_delete when :head client.http_head else raise Error::WebDriverError, "unknown HTTP verb: #{verb.inspect}" end create_response client.response_code, client.body_str, client.content_type end