Skip to content

Commit

Permalink
修改:HttpclientSwoole 更改直接使用 host 不再用学传参
Browse files Browse the repository at this point in the history
  • Loading branch information
wangxian committed Aug 5, 2023
1 parent dad587b commit 6a9f2d4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Http/HttpclientSwoole.php
Expand Up @@ -45,12 +45,12 @@ protected function request($url, $method = self::GET, $params = array(), $option
$is_ssl = isset($paths['scheme']) && $paths['scheme'] == 'https';
$port = isset($paths['port']) ? $paths['port'] : ($is_ssl ? 443 : 80);

$ip = \Swoole\Coroutine::gethostbyname($host);
if ( !$ip ) {
\throw_error('Coroutine::gethostbyname("'. $host .'") host is empty', 19220);
}
// $ip = \Swoole\Coroutine::gethostbyname($host);
// if ( !$ip ) {
// \throw_error('Coroutine::gethostbyname("'. $host .'") host is empty', 19220);
// }

$cli = new \Swoole\Coroutine\Http\Client($ip, $port, $is_ssl);
$cli = new \Swoole\Coroutine\Http\Client($host, $port, $is_ssl);

// 兼容httpclient的header头
$headers = ['Host' => $host];
Expand Down

0 comments on commit 6a9f2d4

Please sign in to comment.