Skip to content

Commit

Permalink
Added possibility to switch off/on SSL verify peer option using Unire…
Browse files Browse the repository at this point in the history
…st::$verifyPeer Kong#27
  • Loading branch information
jasir committed Dec 18, 2013
1 parent 45cb590 commit dd8b344
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/Unirest/Unirest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@

class Unirest
{
/**
* Verify SSL peer
* @var bool
*/
public static $verifyPeer = true;

private static $socketTimeout = null;
private static $defaultHeaders = array();
Expand Down Expand Up @@ -151,7 +156,7 @@ private static function request($httpMethod, $url, $body = NULL, $headers = arra
curl_setopt ($ch, CURLOPT_MAXREDIRS, 10);
curl_setopt ($ch, CURLOPT_HTTPHEADER, $lowercaseHeaders);
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.
if (Unirest::$socketTimeout != null) {
curl_setopt ($ch, CURLOPT_TIMEOUT, Unirest::$socketTimeout);
Expand Down

0 comments on commit dd8b344

Please sign in to comment.