From da8a48f89eae1efe34ce2bafc8cb230a9b7933be Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 25 Feb 2017 13:59:24 +0000 Subject: [PATCH] Bugfix: the curl option CURLOPT_SSL_VERIFYHOST is problematic --- include/ParseUrl.php | 4 +++- include/network.php | 8 ++++++-- include/poller.php | 3 ++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/include/ParseUrl.php b/include/ParseUrl.php index 3a2fe9d53c..e9ac527a1a 100644 --- a/include/ParseUrl.php +++ b/include/ParseUrl.php @@ -146,7 +146,9 @@ class ParseUrl { curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERAGENT, $a->get_useragent()); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, (($check_cert) ? true : false)); - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, (($check_cert) ? 2 : false)); + if ($check_cert) { + @curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); + } $header = curl_exec($ch); $curl_info = @curl_getinfo($ch); diff --git a/include/network.php b/include/network.php index 03f65a5190..749f996f8c 100644 --- a/include/network.php +++ b/include/network.php @@ -118,7 +118,9 @@ function z_fetch_url($url,$binary = false, &$redirects = 0, $opts=array()) { $check_cert = get_config('system','verifyssl'); @curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, (($check_cert) ? true : false)); - @curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, (($check_cert) ? 2 : false)); + if ($check_cert) { + @curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); + } $prx = get_config('system','proxy'); if(strlen($prx)) { @@ -265,7 +267,9 @@ function post_url($url,$params, $headers = null, &$redirects = 0, $timeout = 0) $check_cert = get_config('system','verifyssl'); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, (($check_cert) ? true : false)); - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, (($check_cert) ? 2 : false)); + if ($check_cert) { + @curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); + } $prx = get_config('system','proxy'); if(strlen($prx)) { curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1); diff --git a/include/poller.php b/include/poller.php index e8bfb88389..8be4c1835c 100644 --- a/include/poller.php +++ b/include/poller.php @@ -11,7 +11,6 @@ if (!file_exists("boot.php") AND (sizeof($_SERVER["argv"]) != 0)) { } use \Friendica\Core\Config; -use \Friendica\Core\PConfig; require_once("boot.php"); @@ -29,6 +28,8 @@ function poller_run($argv, $argc){ unset($db_host, $db_user, $db_pass, $db_data); }; + Config::load(); + // Quit when in maintenance if (Config::get('system', 'maintenance', true)) { return;