Merge pull request #29 from jasir/fix-27

Added possibility to switch off SSL verify peer option using Unirest::verifyPeer #27
This commit is contained in:
Marco Palladino
2014-01-06 11:52:40 -08:00

View File

@@ -5,6 +5,11 @@
class Unirest class Unirest
{ {
/**
* Verify SSL peer
* @var bool
*/
public static $verifyPeer = true;
private static $socketTimeout = null; private static $socketTimeout = null;
private static $defaultHeaders = array(); private static $defaultHeaders = array();
@@ -151,7 +156,7 @@
curl_setopt ($ch, CURLOPT_MAXREDIRS, 10); curl_setopt ($ch, CURLOPT_MAXREDIRS, 10);
curl_setopt ($ch, CURLOPT_HTTPHEADER, $lowercaseHeaders); curl_setopt ($ch, CURLOPT_HTTPHEADER, $lowercaseHeaders);
curl_setopt ($ch, CURLOPT_HEADER, true); curl_setopt ($ch, CURLOPT_HEADER, true);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, true); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, Unirest::$verifyPeer);
curl_setopt ($ch, CURLOPT_ENCODING, ""); // If an empty string, "", is set, a header containing all supported encoding types is sent. curl_setopt ($ch, CURLOPT_ENCODING, ""); // If an empty string, "", is set, a header containing all supported encoding types is sent.
if (Unirest::$socketTimeout != null) { if (Unirest::$socketTimeout != null) {
curl_setopt ($ch, CURLOPT_TIMEOUT, Unirest::$socketTimeout); curl_setopt ($ch, CURLOPT_TIMEOUT, Unirest::$socketTimeout);