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