改名
This commit is contained in:
@@ -10,6 +10,7 @@ declare(strict_types=1);
|
||||
namespace HttpServer\Client;
|
||||
|
||||
use Exception;
|
||||
use Swoole\Coroutine;
|
||||
use Swoole\Coroutine\Http\Client as SClient;
|
||||
|
||||
/**
|
||||
|
||||
@@ -733,19 +733,14 @@ abstract class ClientAbstracts extends Component implements IClient
|
||||
if (strpos($domain, ':' . $port) !== false) {
|
||||
$domain = str_replace(':' . $port, '', $domain);
|
||||
}
|
||||
$this->port = $isHttps ? 443 : $this->port;
|
||||
if (isIp($domain)) {
|
||||
$this->host = $domain;
|
||||
} else {
|
||||
} else if ($this->isUseSwoole()) {
|
||||
$this->host = System::gethostbyname($domain) ?? $domain;
|
||||
} else {
|
||||
$this->host = $domain;
|
||||
}
|
||||
|
||||
if (!empty($this->port)) {
|
||||
$port = $this->port;
|
||||
}
|
||||
if (!empty($port) && $port != 443) {
|
||||
$this->host .= ':' . $port;
|
||||
}
|
||||
|
||||
$this->header['Host'] = $domain;
|
||||
if (strpos($path, '/') !== 0) {
|
||||
$path = '/' . $path;
|
||||
|
||||
@@ -114,7 +114,7 @@ class Curl extends ClientAbstracts
|
||||
if ($method === self::POST || $method == self::UPLOAD) {
|
||||
curl_setopt($resource, CURLOPT_POST, 1);
|
||||
}
|
||||
curl_setopt($resource, CURLOPT_CUSTOMREQUEST, $method);
|
||||
curl_setopt($resource, CURLOPT_CUSTOMREQUEST, strtoupper($method));
|
||||
|
||||
return $resource;
|
||||
}
|
||||
@@ -207,7 +207,6 @@ class Curl extends ClientAbstracts
|
||||
foreach ($this->getHeader() as $key => $val) {
|
||||
$headers[$key] = $key . ': ' . $val;
|
||||
}
|
||||
var_dump($headers);
|
||||
return array_values($headers);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,9 @@ class Result
|
||||
public $code;
|
||||
public $message;
|
||||
public int $count = 0;
|
||||
public ?array $data;
|
||||
|
||||
/** @var mixed $data */
|
||||
public $data;
|
||||
public ?array $header;
|
||||
public int $httpStatus = 200;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user