Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Commit f666d1d

Browse files
committed
Fix a curl connect timeout issue
We are seeing error like this. `'WebDriverCurlException' with message 'Curl error thrown for http POST to /session/38719813-dd76-4d78-838c-491016a2f4cf/url with params: {"url":"https:\/\/www.facebook.com\/"}` This is because the default value for CURLOPT_TIMEOUT_MS is too small. Change it to a reasonable value.
1 parent 46d14c7 commit f666d1d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/remote/HttpCommandExecutor.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,15 @@ public function __construct($url) {
133133
'Accept: application/json',
134134
)
135135
);
136-
$this->setTimeout(300000);
136+
curl_setopt($this->curl, CURLOPT_TIMEOUT_MS, 300000);
137+
$this->setConnectionTimeout(300000);
137138
}
138139

139140
/**
140141
* @param int $timeout
141142
* @return HttpCommandExecutor
142143
*/
143-
public function setTimeout($timeout) {
144+
public function setConnectionTimeout($timeout) {
144145
// There is a PHP bug in some versions which didn't define the constant.
145146
curl_setopt($this->curl, /* CURLOPT_CONNECTTIMEOUT_MS */ 156, $timeout);
146147
return $this;

lib/remote/RemoteWebDriver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public static function create(
6363
}
6464

6565
$executor = new HttpCommandExecutor($url);
66-
$executor->setTimeout($timeout_in_ms);
66+
$executor->setConnectionTimeout($timeout_in_ms);
6767

6868
$command = new WebDriverCommand(
6969
null,

0 commit comments

Comments
 (0)