add clear

This commit is contained in:
2020-04-03 17:40:47 +08:00
parent dd32f8003a
commit cda357bc68
+4 -13
View File
@@ -461,11 +461,7 @@ class HttpClient
{ {
$client = new SClient($host, $this->getHostPort(), $this->isSSL); $client = new SClient($host, $this->getHostPort(), $this->isSSL);
$settings = $this->settings();
if (!empty($settings)) {
$client->set($this->settings()); $client->set($this->settings());
}
if (!empty($this->agent)) { if (!empty($this->agent)) {
$this->header['User-Agent'] = $this->agent; $this->header['User-Agent'] = $this->agent;
} }
@@ -475,8 +471,6 @@ class HttpClient
if (!empty($this->_data)) { if (!empty($this->_data)) {
$client->setData($this->_data); $client->setData($this->_data);
} }
$url = ltrim($url, '/');
if (strtolower($this->method) == self::GET) { if (strtolower($this->method) == self::GET) {
if (!empty($data)) { if (!empty($data)) {
$url .= '?' . $data; $url .= '?' . $data;
@@ -503,9 +497,6 @@ class HttpClient
} else { } else {
$client->post($url, $data); $client->post($url, $data);
} }
var_dump($client, $url);
$client->close(); $client->close();
return $client; return $client;
} }
@@ -516,10 +507,10 @@ class HttpClient
$sslCert = $this->getSslCertFile(); $sslCert = $this->getSslCertFile();
$sslKey = $this->getSslKeyFile(); $sslKey = $this->getSslKeyFile();
$sslCa = $this->getCa(); $sslCa = $this->getCa();
//
if (empty($sslCert) || empty($sslKey) || empty($sslCa)) { // if (empty($sslCert) || empty($sslKey) || empty($sslCa)) {
return []; // return [];
} // }
$params['ssl_host_name'] = $this->host; $params['ssl_host_name'] = $this->host;
$params['ssl_cert_file'] = $this->getSslCertFile(); $params['ssl_cert_file'] = $this->getSslCertFile();
$params['ssl_key_file'] = $this->getSslKeyFile(); $params['ssl_key_file'] = $this->getSslKeyFile();