Skip to content
Open
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
2 changes: 1 addition & 1 deletion google/appengine/runtime/CurlLite.php
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ private function setOption($key, $value) {
$this->request->setDeadline($value);
break;
case CURLOPT_TIMEOUT_MS:
$this->request->setDeadline($value * 1000);
$this->request->setDeadline($value / 1000);
break;
case CURLOPT_CUSTOMREQUEST:
if (!in_array($value, array_keys(static::$custom_request_map))) {
Expand Down
18 changes: 18 additions & 0 deletions google/appengine/runtime/CurlLiteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,24 @@ public function testGetInfo() {
$this->apiProxyMock->verify();
}

public function testSetTimeoutMS() {
$url = 'http://google.com';
$this->setupRequest($url);
$this->request->setDeadline(0.5);
$this->apiProxyMock->expectCall('urlfetch',
'Fetch',
$this->request,
$this->response);

$curl_lite = new CurlLite();
$result = $curl_lite->setOptionsArray([
CURLOPT_TIMEOUT_MS => 500,
CURLOPT_URL => $url
]);
$curl_lite->exec();
$this->assertEquals($result, true);
}

public function mockLog($log_level, $log_message) {
$this->assertFalse(empty($this->expected_log_messages));
$expected = array_shift($this->expected_log_messages);
Expand Down