Skip to content

Commit

Permalink
Continue HTTP request even if unable to use shipped root certificates…
Browse files Browse the repository at this point in the history
…. Works around long path bug in OpenSSL 0.9.7
  • Loading branch information
Willem Stuursma committed Jun 18, 2014
1 parent ca8eb11 commit 01ca9a5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Mollie/API/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,20 @@ public function performHttpCall ($http_method, $api_method, $http_body = NULL)
curl_setopt($ch, CURLOPT_HTTPHEADER, $request_headers);
curl_setopt($ch, CURLOPT_CAINFO, realpath(dirname(__FILE__) . "/cacert.pem"));
$body = curl_exec($ch);

if (strpos(curl_error($ch), "error setting certificate verify locations") !== FALSE)
{
/*
* Error setting CA-file. Could be missing, or there is a bug in OpenSSL with too long paths.
* We give up. Don't do any peer validations.
*
* @internal #MOL017891004
*/
array_shift($request_headers);
$request_headers[] = "X-Mollie-Debug: unable to use shipped root certificaties, no peer validation.";
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$body = curl_exec($ch);
}
}

if (strpos(curl_error($ch), "certificate subject name 'mollie.nl' does not match target host") !== FALSE)
Expand Down

0 comments on commit 01ca9a5

Please sign in to comment.