Skip to content

Commit 01ca9a5

Browse files
author
Willem Stuursma
committed
Continue HTTP request even if unable to use shipped root certificates. Works around long path bug in OpenSSL 0.9.7
1 parent ca8eb11 commit 01ca9a5

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/Mollie/API/Client.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,20 @@ public function performHttpCall ($http_method, $api_method, $http_body = NULL)
219219
curl_setopt($ch, CURLOPT_HTTPHEADER, $request_headers);
220220
curl_setopt($ch, CURLOPT_CAINFO, realpath(dirname(__FILE__) . "/cacert.pem"));
221221
$body = curl_exec($ch);
222+
223+
if (strpos(curl_error($ch), "error setting certificate verify locations") !== FALSE)
224+
{
225+
/*
226+
* Error setting CA-file. Could be missing, or there is a bug in OpenSSL with too long paths.
227+
* We give up. Don't do any peer validations.
228+
*
229+
* @internal #MOL017891004
230+
*/
231+
array_shift($request_headers);
232+
$request_headers[] = "X-Mollie-Debug: unable to use shipped root certificaties, no peer validation.";
233+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
234+
$body = curl_exec($ch);
235+
}
222236
}
223237

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

0 commit comments

Comments
 (0)