From d4a163c6a87628c7dbc4fd3697a40c55f5659be6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Helfensd=C3=B6rfer?= Date: Thu, 3 Jan 2019 18:36:43 +0100 Subject: [PATCH] Added option to disable curl ssl verification --- src/AutoUpdate.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/AutoUpdate.php b/src/AutoUpdate.php index 8337f58..7833bfc 100755 --- a/src/AutoUpdate.php +++ b/src/AutoUpdate.php @@ -100,6 +100,13 @@ class AutoUpdate */ private $onAllUpdateFinishCallbacks = []; + /** + * If curl should verify the host certificate. + * + * @var bool + */ + private $sslVerifyHost = true; + /** * Url to the update folder on the server. * @@ -404,6 +411,24 @@ public function getSimulationResults() return $this->simulationResults; } + /** + * @return bool + */ + public function getSslVerifyHost() + { + return $this->sslVerifyHost; + } + + /** + * @param bool $sslVerifyHost + */ + public function setSslVerifyHost($sslVerifyHost) + { + $this->sslVerifyHost = $sslVerifyHost; + + return $this; + } + /** * Check for a new version * @@ -562,6 +587,8 @@ protected function _downloadCurl($url) $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, $this->sslVerifyHost); + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $this->sslVerifyHost); $update = curl_exec($curl); $error = false;