diff --git a/app/Controller/ServersController.php b/app/Controller/ServersController.php index 39383a97e..9d89153cc 100755 --- a/app/Controller/ServersController.php +++ b/app/Controller/ServersController.php @@ -403,7 +403,7 @@ class ServersController extends AppController { if(!empty($proxy['host'])) { App::uses('SyncTool', 'Tools'); $syncTool = new SyncTool(); - $HttpSocket = $syncTool->setupHttpSocket('www.example.com'); + $HttpSocket = $syncTool->setupHttpSocket(); $proxyResponse = $HttpSocket->get('http://www.example.com/'); if(empty($proxyResponse)) { $proxyStatus = 1; @@ -475,7 +475,7 @@ class ServersController extends AppController { set_error_handler(function() {}); App::uses('SyncTool', 'Tools'); $syncTool = new SyncTool(); - $HttpSocket = $syncTool->setupHttpSocket('api.github.com'); + $HttpSocket = $syncTool->setupHttpSocket(); $response = $HttpSocket->get('https://api.github.com/repos/MISP/MISP/tags'); $tags = $response->body; restore_error_handler(); diff --git a/app/Lib/Tools/SyncTool.php b/app/Lib/Tools/SyncTool.php index d62b34cd6..c55195063 100644 --- a/app/Lib/Tools/SyncTool.php +++ b/app/Lib/Tools/SyncTool.php @@ -2,10 +2,10 @@ class SyncTool { // take a server as parameter and return a HttpSocket object using the ssl options defined in the server settings - public function setupHttpSocket($server) { + public function setupHttpSocket($server = null) { $params = array(); App::uses('HttpSocket', 'Network/Http'); - if(!empty($server['Server'])) { + if(!empty($server)) { if ($server['Server']['cert_file']) $params['ssl_cafile'] = APP . "files" . DS . "certs" . DS . $server['Server']['id'] . '.pem'; if ($server['Server']['self_signed']) $params['ssl_allow_self_signed'] = $server['Server']['self_signed']; }