Skip to content

Instantly share code, notes, and snippets.

@lucasaba
Created May 28, 2013 08:05
Show Gist options
  • Save lucasaba/5661223 to your computer and use it in GitHub Desktop.
Save lucasaba/5661223 to your computer and use it in GitHub Desktop.
Proposed change to SensioLabs\Connect\Buzz\Client\Curl
<?php
namespace SensioLabs\Connect\Buzz\Client;
use Buzz\Client\Curl as BaseCurl;
use Buzz\Message;
/**
* Curl
*
* @author Marc Weistroff <marc.weistroff@sensiolabs.com>
*/
class Curl extends BaseCurl
{
public function send(RequestInterface $request, MessageInterface $response, array $options = array())
{
try {
parent::send(RequestInterface $request, MessageInterface $response, array $options = array());
} catch(ClientException $e) {
if (curl_errno($this->lastCurl) == 60) { // CURLE_SSL_CACERT
curl_setopt($this->lastCurl, CURLOPT_CAINFO,
dirname(__FILE__) . '/sensio_connect_ca_chain_bundle.crt');
$data = curl_exec($this->lastCurl);
static::populateResponse($this->lastCurl, $data, $response);
} else {
$errorMsg = curl_error($this->lastCurl);
$errorNo = curl_errno($this->lastCurl);
throw new ClientException($errorMsg, $errorNo);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment