Skip to content

Commit

Permalink
Merge pull request #108 from p7s1digital/support-timeout-in-milliseconds
Browse files Browse the repository at this point in the history
Support timeouts in milliseconds for Curl client.
  • Loading branch information
kriswallsmith committed Feb 19, 2013
2 parents a6396a7 + e22a205 commit e225550
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/Buzz/Client/AbstractCurl.php
Expand Up @@ -178,7 +178,11 @@ protected function prepare($curl, RequestInterface $request, array $options = ar
static::setOptionsFromRequest($curl, $request);

// apply settings from client
curl_setopt($curl, CURLOPT_TIMEOUT, $this->getTimeout());
if ($this->getTimeout() < 1) {
curl_setopt($curl, CURLOPT_TIMEOUT_MS, $this->getTimeout() * 1000);
} else {
curl_setopt($curl, CURLOPT_TIMEOUT, $this->getTimeout());
}
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 0 < $this->getMaxRedirects());
curl_setopt($curl, CURLOPT_MAXREDIRS, $this->getMaxRedirects());
curl_setopt($curl, CURLOPT_FAILONERROR, !$this->getIgnoreErrors());
Expand Down

0 comments on commit e225550

Please sign in to comment.