Created
May 28, 2013 08:05
-
-
Save lucasaba/5661223 to your computer and use it in GitHub Desktop.
Proposed change to SensioLabs\Connect\Buzz\Client\Curl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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