Skip to content
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
9 changes: 9 additions & 0 deletions src/Jira/Api/Client/CurlClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@

class CurlClient implements ClientInterface
{
/**
* Default timeout for CURL requests
*
* @var int seconds
*/
protected $timeout = 10;

/**
* create a traditional php client
Expand Down Expand Up @@ -93,6 +99,9 @@ public function sendRequest(
curl_setopt($curl, CURLOPT_USERPWD, sprintf('%s:%s', $credential->getId(), $credential->getPassword()));
}

if (is_numeric($this->timeout)) {
curl_setopt($curl, CURLOPT_TIMEOUT, $this->timeout);
}
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_VERBOSE, $debug);
Expand Down
4 changes: 4 additions & 0 deletions tests/Jira/Api/Client/CurlClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ protected function createClient()
return new CurlClient();
}

protected function testTimeout()
{
return new CurlClient();
}
}