This commit is contained in:
2021-12-11 05:41:45 +08:00
parent b0fe5ab4c4
commit 3693fd40f6
+2 -6
View File
@@ -50,18 +50,14 @@ class Curl extends ClientAbstracts
if ($this->getPort() != 443 && $this->getPort() != 80) { if ($this->getPort() != 443 && $this->getPort() != 80) {
$host .= ':' . $this->getPort(); $host .= ':' . $this->getPort();
} }
var_dump($host . $path);
$this->do(curl_init($host . $path), $host . $path, $method); $this->do(curl_init($host . $path), $host . $path, $method);
if ($isHttps !== false) { if ($isHttps !== false) {
$this->curlHandlerSslSet(); $this->curlHandlerSslSet();
} }
$contents = $this->getData()->getContents(); $contents = $this->getData()->getContents();
if (empty($params) && empty($contents)) { if (empty($params) && empty($contents)) {
return; return;
} }
if (!empty($contents)) { if (!empty($contents)) {
curl_setopt($this->client, CURLOPT_POSTFIELDS, $contents); curl_setopt($this->client, CURLOPT_POSTFIELDS, $contents);
} else if ($method === self::POST) { } else if ($method === self::POST) {
@@ -104,7 +100,7 @@ class Curl extends ClientAbstracts
curl_setopt($resource, CURLOPT_HTTPHEADER, $this->parseHeaderMat()); curl_setopt($resource, CURLOPT_HTTPHEADER, $this->parseHeaderMat());
if (defined('CURLOPT_SSL_FALSESTART')) { if (defined('CURLOPT_SSL_FALSESTART')) {
// curl_setopt($resource, CURLOPT_SSL_FALSESTART, true); curl_setopt($resource, CURLOPT_SSL_FALSESTART, true);
} }
curl_setopt($resource, CURLOPT_FORBID_REUSE, false); curl_setopt($resource, CURLOPT_FORBID_REUSE, false);
curl_setopt($resource, CURLOPT_FRESH_CONNECT, false); curl_setopt($resource, CURLOPT_FRESH_CONNECT, false);
@@ -133,7 +129,7 @@ class Curl extends ClientAbstracts
{ {
$output = curl_exec($this->client); $output = curl_exec($this->client);
if ($output === false) { if ($output === false) {
$this->setStatusCode(404); $this->setStatusCode(curl_errno($this->client));
$this->setBody(curl_error($this->client)); $this->setBody(curl_error($this->client));
} else { } else {
$this->explode($output); $this->explode($output);