MISP/app/Lib/Tools/SyncTool.php

18 lines
709 B
PHP
Raw Normal View History

<?php
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) {
$params = array();
App::uses('HttpSocket', 'Network/Http');
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'];
$HttpSocket = new HttpSocket($params);
2015-03-18 17:58:14 +01:00
$proxy = Configure::read('Proxy');
$HttpSocket->configProxy($proxy['host'], $proxy['port'], $proxy['method'], $proxy['user'], $proxy['password']);
return $HttpSocket;
}
}