swoole-src
swoole-src copied to clipboard
With the Socks5 proxy enabled, the Coroutine HTTP client uses IPv6 addresses as domain names for DNS resolution
Please answer these questions before submitting your issue. Thanks!
- What did you do? If possible, provide a simple script for reproducing the error.
use Swoole\Coroutine\Http\Client;
use function Swoole\Coroutine\run;
run(function () {
$client = new Client('2600:1417:7800:8ad::180c', 443, true);
$client->setHeaders([
'Host' => 'www.qq.com'
]);
$client->set([
'ssl_host_name' => 'www.qq.com',
'socks5_host' => '127.0.0.1',
'socks5_port' => 1067
]);
$client->get('/');
echo $client->errMsg;
echo $client->body;
$client->close();
});
- What did you expect to see?
DNS Lookup resolve failed.
-
What did you see instead? Proper handling of IPv6 addresses.
-
What version of Swoole are you using (show your
php --ri swoole
)?
php --ri swoole
swoole
Swoole => enabled
Author => Swoole Team <[email protected]>
Version => 4.7.0-dev
Built => Jul 4 2021 03:11:21
coroutine => enabled with boost asm context
epoll => enabled
eventfd => enabled
signalfd => enabled
cpu_affinity => enabled
spinlock => enabled
rwlock => enabled
openssl => OpenSSL 1.1.1k FIPS 25 Mar 2021
dtls => enabled
http2 => enabled
zlib => 1.2.11
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
async_redis => enabled
Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => On => On
swoole.unixsock_buffer_size => 8388608 => 8388608
Changing socks5_host to [::] will fix,But set to [::] does not support IPv4 URLs.