diff --git a/src/Unirest/Request.php b/src/Unirest/Request.php index 77a2821..9f96eeb 100644 --- a/src/Unirest/Request.php +++ b/src/Unirest/Request.php @@ -15,6 +15,7 @@ class Request private static $jsonOpts = array(); private static $socketTimeout = null; private static $verifyPeer = true; + private static $verifyHost = true; private static $auth = array ( 'user' => '', @@ -55,6 +56,16 @@ class Request { return self::$verifyPeer = $enabled; } + + /** + * Verify SSL host + * + * @param bool $enabled enable SSL host verification, by default is true + */ + public static function verifyHost($enabled) + { + return self::$verifyHost = $enabled; + } /** * Set a timeout @@ -405,6 +416,7 @@ class Request CURLOPT_HTTPHEADER => self::getFormattedHeaders($headers), CURLOPT_HEADER => true, CURLOPT_SSL_VERIFYPEER => self::$verifyPeer, + CURLOPT_SSL_VERIFYHOST => self::$verifyHost, // If an empty string, '', is set, a header containing all supported encoding types is sent CURLOPT_ENCODING => '' ));