Skip to content

Commit

Permalink
Add configurable timeout for curl connections
Browse files Browse the repository at this point in the history
  • Loading branch information
Eileen Xie committed Apr 23, 2014
1 parent 593595a commit 4145664
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions WebDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

class WebDriver {
public static $ImplicitWaitMS = 0; // How long to wait for elements to appear on the page
public static $CurlConnectTimeoutSec = 30; // How long to wait to connect to the server
public static $CurlTimeoutSec = 120; // How long to wait for the server's response to any single command

// See http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value
Expand Down Expand Up @@ -87,6 +88,7 @@ public static function Curl($http_type, $full_url, $payload = null, $escape_payl
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_HEADER, TRUE);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Expect:'));
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, WebDriver::$CurlConnectTimeoutSec);
curl_setopt($curl, CURLOPT_TIMEOUT, WebDriver::$CurlTimeoutSec);
if ($payload !== null && is_string($payload) && json_decode($payload) !== null) {
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
Expand Down

0 comments on commit 4145664

Please sign in to comment.