Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Including ssl bundle

  • Loading branch information...
commit ee680ad28329811a76bf4b68e3b4e84011094fc2 1 parent 2cb3b49
@alexjg alexjg authored
Showing with 3,835 additions and 3 deletions.
  1. +10 −3 lib/GoCardless/Request.php
  2. +3,825 −0 lib/GoCardless/cert-bundle.crt
View
13 lib/GoCardless/Request.php
@@ -67,7 +67,7 @@ protected static function call($method, $url, $params = array()) {
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 60,
- CURLOPT_USERAGENT => 'gocardless-php/v' . GoCardless::VERSION
+ CURLOPT_USERAGENT => 'gocardless-php/v' . GoCardless::VERSION,
);
// Set application specific user agent suffix if found
@@ -87,8 +87,8 @@ protected static function call($method, $url, $params = array()) {
// Debug - DO NOT USE THIS IN PRODUCTION FOR SECURITY REASONS
//
// This fixes a problem in some environments with connecting to HTTPS-enabled servers.
- // Sometimes, Curl has no list of valid CAs, and so won't connect. With this fix, it
- // doesn't verify and just connects anyway, instead of throwing an exception.
+ // Sometimes, Curl has no list of valid CAs, and so won't connect. With this fix, it
+ // doesn't verify and just connects anyway, instead of throwing an exception.
//
//$curl_options[CURLOPT_SSL_VERIFYPEER] = false;
@@ -166,6 +166,13 @@ protected static function call($method, $url, $params = array()) {
// Send the request
$result = curl_exec($ch);
+ $error = curl_errno($ch);
+
+ if ($error == CURLE_SSL_PEER_CERTIFICATE || $error == CURLE_SSL_CACERT ||
+ $error == 77) {
+ curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__) . '/cert-bundle.crt');
+ $result = curl_exec($ch);
+ }
// Debug
//echo "<pre>\nCurl result config:\n";
View
3,825 lib/GoCardless/cert-bundle.crt
3,825 additions, 0 deletions not shown
Please sign in to comment.
Something went wrong with that request. Please try again.