Permalink
Browse files

Making certificate bundle optional.

  • Loading branch information...
1 parent 1b4c5cf commit edb47e87d81cd0656ec1e09800a977324eba05a5 @jmathai jmathai committed May 13, 2011
Showing with 13 additions and 3 deletions.
  1. +13 −3 EpiOAuth.php
View
@@ -170,9 +170,19 @@ protected function curlInit($url)
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
if(isset($_SERVER ['SERVER_ADDR']) && !empty($_SERVER['SERVER_ADDR']) && $_SERVER['SERVER_ADDR'] != '127.0.0.1')
curl_setopt($ch, CURLOPT_INTERFACE, $_SERVER ['SERVER_ADDR']);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
- curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__) . DIRECTORY_SEPARATOR . 'ca-bundle.crt');
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
+
+ // if the certificate exists then use it, else bypass ssl checks
+ if(file_exists($cert = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'ca-bundle.crt'))
+ {
+ curl_setopt($ch, CURLOPT_CAINFO, $cert);
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
+ }
+ else
+ {
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
+ }
return $ch;
}

0 comments on commit edb47e8

Please sign in to comment.