mirror of
https://github.com/twisterarmy/cloud-server.git
synced 2025-03-13 05:51:46 +00:00
add ssl mode with self-signed certificate support
This commit is contained in:
parent
c7252261c0
commit
ca692ef60d
@ -19,7 +19,8 @@ $_twister = new Twister(
|
|||||||
TWISTER_HOST,
|
TWISTER_HOST,
|
||||||
TWISTER_PORT,
|
TWISTER_PORT,
|
||||||
TWISTER_USER,
|
TWISTER_USER,
|
||||||
TWISTER_PASSWORD
|
TWISTER_PASSWORD,
|
||||||
|
TWISTER_SSL
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ define('DB_PASSWORD', '');
|
|||||||
// TWISTER
|
// TWISTER
|
||||||
define('TWISTER_HOST', 'localhost');
|
define('TWISTER_HOST', 'localhost');
|
||||||
define('TWISTER_PORT', 28332);
|
define('TWISTER_PORT', 28332);
|
||||||
|
define('TWISTER_SSL', true);
|
||||||
define('TWISTER_PROTOCOL', '');
|
define('TWISTER_PROTOCOL', '');
|
||||||
define('TWISTER_USER', '');
|
define('TWISTER_USER', '');
|
||||||
define('TWISTER_PASSWORD', '');
|
define('TWISTER_PASSWORD', '');
|
||||||
|
@ -6,16 +6,19 @@ class Curl {
|
|||||||
private $_protocol;
|
private $_protocol;
|
||||||
private $_host;
|
private $_host;
|
||||||
private $_port;
|
private $_port;
|
||||||
|
private $_ssl;
|
||||||
|
|
||||||
public function __construct(string $protocol,
|
public function __construct(string $protocol,
|
||||||
string $host,
|
string $host,
|
||||||
int $port,
|
int $port,
|
||||||
string $username,
|
string $username,
|
||||||
string $password) {
|
string $password,
|
||||||
|
bool $ssl) {
|
||||||
|
|
||||||
$this->_protocol = $protocol;
|
$this->_protocol = $protocol;
|
||||||
$this->_host = $host;
|
$this->_host = $host;
|
||||||
$this->_port = $port;
|
$this->_port = $port;
|
||||||
|
$this->_ssl = $ssl;
|
||||||
|
|
||||||
$this->_curl = curl_init();
|
$this->_curl = curl_init();
|
||||||
|
|
||||||
@ -52,7 +55,7 @@ class Curl {
|
|||||||
curl_setopt($this->_curl, CURLOPT_CONNECTTIMEOUT, $timeout);
|
curl_setopt($this->_curl, CURLOPT_CONNECTTIMEOUT, $timeout);
|
||||||
curl_setopt($this->_curl, CURLOPT_TIMEOUT, $timeout);
|
curl_setopt($this->_curl, CURLOPT_TIMEOUT, $timeout);
|
||||||
|
|
||||||
if ($method == 'https') {
|
if ($this->_ssl) {
|
||||||
curl_setopt($this->_curl, CURLOPT_SSL_VERIFYPEER, $validate);
|
curl_setopt($this->_curl, CURLOPT_SSL_VERIFYPEER, $validate);
|
||||||
curl_setopt($this->_curl, CURLOPT_SSL_VERIFYHOST, $validate);
|
curl_setopt($this->_curl, CURLOPT_SSL_VERIFYHOST, $validate);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user