Merge pull request #3188 from annando/bugfix-fetch_url

Bugfix: the curl option CURLOPT_SSL_VERIFYHOST is problematic
This commit is contained in:
Tobias Diekershoff 2017-02-26 04:19:22 +01:00 committed by GitHub
commit b850eb248a
3 changed files with 11 additions and 4 deletions

View file

@ -146,7 +146,9 @@ class ParseUrl {
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, $a->get_useragent()); curl_setopt($ch, CURLOPT_USERAGENT, $a->get_useragent());
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, (($check_cert) ? true : false)); 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); $header = curl_exec($ch);
$curl_info = @curl_getinfo($ch); $curl_info = @curl_getinfo($ch);

View file

@ -118,7 +118,9 @@ function z_fetch_url($url,$binary = false, &$redirects = 0, $opts=array()) {
$check_cert = get_config('system','verifyssl'); $check_cert = get_config('system','verifyssl');
@curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, (($check_cert) ? true : false)); @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'); $prx = get_config('system','proxy');
if(strlen($prx)) { if(strlen($prx)) {
@ -265,7 +267,9 @@ function post_url($url,$params, $headers = null, &$redirects = 0, $timeout = 0)
$check_cert = get_config('system','verifyssl'); $check_cert = get_config('system','verifyssl');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, (($check_cert) ? true : false)); 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'); $prx = get_config('system','proxy');
if(strlen($prx)) { if(strlen($prx)) {
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1); curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);

View file

@ -11,7 +11,6 @@ if (!file_exists("boot.php") AND (sizeof($_SERVER["argv"]) != 0)) {
} }
use \Friendica\Core\Config; use \Friendica\Core\Config;
use \Friendica\Core\PConfig;
require_once("boot.php"); require_once("boot.php");
@ -29,6 +28,8 @@ function poller_run($argv, $argc){
unset($db_host, $db_user, $db_pass, $db_data); unset($db_host, $db_user, $db_pass, $db_data);
}; };
Config::load();
// Quit when in maintenance // Quit when in maintenance
if (Config::get('system', 'maintenance', true)) { if (Config::get('system', 'maintenance', true)) {
return; return;