Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct Net::HTTP::Persistent bug when using newer versions #8387

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions rb/lib/selenium/webdriver/remote/http/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,8 @@ def close
def http
@http ||= begin
http = new_http_client
if server_url.scheme == 'https'
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
end

set_ssl_options(new_http_client) if server_url.scheme == 'https'

# Defaulting open_timeout to nil to be consistent with Ruby 2.2 and earlier.
http.open_timeout = open_timeout
http.read_timeout = read_timeout if read_timeout
Expand Down Expand Up @@ -139,6 +136,11 @@ def new_http_client
end
end

def set_ssl_options(client)
client.use_ssl = true
client.verify_mode = OpenSSL::SSL::VERIFY_NONE
end

def proxy
@proxy ||= begin
proxy = ENV['http_proxy'] || ENV['HTTP_PROXY']
Expand Down
8 changes: 8 additions & 0 deletions rb/lib/selenium/webdriver/remote/http/persistent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ def new_http_client
Net::HTTP::Persistent.new name: 'webdriver', proxy: proxy
end

def set_ssl_options(client)
# Net::HTTP::Persistent manages its own SSL config for older version
if client.respond_to? :use_ssl=
client.use_ssl = true
client.verify_mode = OpenSSL::SSL::VERIFY_NONE
end
end

def response_for(request)
http.request server_url, request
end
Expand Down