Skip to content

Commit

Permalink
Revert using HTTP default client for service shutdown
Browse files Browse the repository at this point in the history
It doesn't play nicely with IEDriverServer which responds with text/html
content-type, while client only supports application/json

Basically reverts 8389311 while ensuring that default headers are used
so that User-Agent is set properly
  • Loading branch information
p0deje committed May 6, 2019
1 parent 6de54b0 commit 4a49681
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions rb/lib/selenium/webdriver/common/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ def build_process(*command)
end

def connect_to_server
http = Selenium::WebDriver::Remote::Http::Default.new
http.open_timeout = STOP_TIMEOUT / 2
http.read_timeout = STOP_TIMEOUT / 2
http.server_url = uri
yield http
http.close
Net::HTTP.start(@host, @port) do |http|
http.open_timeout = STOP_TIMEOUT / 2
http.read_timeout = STOP_TIMEOUT / 2

yield http
end
end

def find_free_port
Expand All @@ -164,7 +164,10 @@ def stop_process
def stop_server
return if process_exited?

connect_to_server { |http| http.call(:get, '/shutdown', nil) }
connect_to_server do |http|
headers = WebDriver::Remote::Http::Common::DEFAULT_HEADERS.dup
http.get('/shutdown', headers)
end
end

def process_running?
Expand Down

0 comments on commit 4a49681

Please sign in to comment.