add clear
This commit is contained in:
@@ -460,13 +460,7 @@ class HttpClient
|
|||||||
private function generate_client($host, $url, $data)
|
private function generate_client($host, $url, $data)
|
||||||
{
|
{
|
||||||
$client = new SClient($host, $this->getHostPort(), $this->isSSL);
|
$client = new SClient($host, $this->getHostPort(), $this->isSSL);
|
||||||
$client->set([
|
$client->set($this->settings());
|
||||||
'ssl_host_name' => $this->host,
|
|
||||||
'ssl_cert_file' => $this->getSslCertFile(),
|
|
||||||
'ssl_key_file' => $this->getSslKeyFile(),
|
|
||||||
'ssl_verify_peer' => true,
|
|
||||||
'ssl_cafile' => $this->getCa(),
|
|
||||||
]);
|
|
||||||
if (!empty($this->agent)) {
|
if (!empty($this->agent)) {
|
||||||
$this->header['User-Agent'] = $this->agent;
|
$this->header['User-Agent'] = $this->agent;
|
||||||
}
|
}
|
||||||
@@ -506,6 +500,24 @@ class HttpClient
|
|||||||
return $client;
|
return $client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function settings()
|
||||||
|
{
|
||||||
|
$sslCert = $this->getSslCertFile();
|
||||||
|
$sslKey = $this->getSslKeyFile();
|
||||||
|
$sslCa = $this->getCa();
|
||||||
|
if (empty($sslCert) || empty($sslKey) || empty($sslCa)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
$params['ssl_host_name'] = $this->host;
|
||||||
|
$params['ssl_cert_file'] = $this->getSslCertFile();
|
||||||
|
$params['ssl_key_file'] = $this->getSslKeyFile();
|
||||||
|
$params['ssl_verify_peer'] = true;
|
||||||
|
$params['ssl_cafile'] = $sslCa;
|
||||||
|
|
||||||
|
return $params;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $url
|
* @param $url
|
||||||
* @param array $data
|
* @param array $data
|
||||||
|
|||||||
Reference in New Issue
Block a user