From ce0255b2c537801550b89a09ce063e768bef8b79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Wed, 2 Dec 2020 18:50:30 +0800 Subject: [PATCH] add clear --- wchat/common/HttpClient.php | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/wchat/common/HttpClient.php b/wchat/common/HttpClient.php index 639447e..6a51722 100644 --- a/wchat/common/HttpClient.php +++ b/wchat/common/HttpClient.php @@ -657,15 +657,11 @@ class HttpClient curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout); // 超时设置 curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->timeout); // 超时设置 } - curl_setopt($ch, CURLOPT_HEADER, true); - var_dump($url, $this->parseHeaderMat()); - if ($headers = $this->parseHeaderMat()) { - curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); - } - if (!empty($this->agent)) { - curl_setopt($ch, CURLOPT_USERAGENT, $this->agent); - } + curl_setopt($ch, CURLOPT_HEADER, true); + curl_setopt($ch, CURLOPT_HTTPHEADER, $this->parseHeaderMat()); + curl_setopt($ch, CURLOPT_USERAGENT, $this->agent); + if (file_exists($cert = $this->getSslCertFile())) { curl_setopt($ch, CURLOPT_SSLCERT, $cert); } @@ -986,7 +982,7 @@ class HttpClient } $headers = []; foreach ($this->header as $key => $val) { - $header = $key . ':' . $val; + $header = $key . ': ' . $val; if (in_array($header, $headers)) { continue; }