swoole-src
swoole-src copied to clipboard
SSL negotiation error on HTTP2 client in OpenSSL 3.0.2 environment
[2022-04-28 17:24:05 @19976.0] NOTICE Socket::ssl_connect(fd=11) to server[0.0.0.0:27407] failed. Error: error:1409442E:SSL routines:ssl3_read_bytes:tlsv1 alert protocol version[1|1070]
openssl version
OpenSSL 3.0.2 15 Mar 2022 (Library: OpenSSL 3.0.2 15 Mar 2022)
php --ri swoole
swoole
Swoole => enabled
Author => Swoole Team <[email protected]>
Version => 4.8.9
Built => Apr 28 2022 17:14:04
coroutine => enabled with boost asm context
epoll => enabled
eventfd => enabled
signalfd => enabled
cpu_affinity => enabled
spinlock => enabled
rwlock => enabled
openssl => OpenSSL 3.0.2 15 Mar 2022
dtls => enabled
http2 => enabled
pcre => enabled
c-ares => 1.17.2
zlib => 1.2.11
brotli => E16777225/D16777225
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 => Off => Off
swoole.unixsock_buffer_size => 8388608 => 8388608
Please provide a simple script for reproducing the error.
use Swoole\Http2\Request;
use Swoole\Coroutine\Http2\Client;
use function Swoole\Coroutine\run;
run(function () {
$domain = 'www.zhihu.com';
$cli = new Client($domain, 443, true);
$cli->set([
'timeout' => -1,
'ssl_host_name' => $domain
]);
$cli->connect();
$req = new Request();
$req->method = 'POST';
$req->path = '/api/v4/answers/300000000/voters';
$req->headers = [
'host' => $domain,
'user-agent' => 'Chrome/49.0.2587.3',
'accept' => 'text/html,application/xhtml+xml,application/xml',
'accept-encoding' => 'gzip'
];
$req->data = '{"type":"up"}';
$cli->send($req);
$response = $cli->recv();
var_dump(assert(json_decode($response->data)->error->code === 10002));
});
这是单测里的代码吧,单测都能跑通的,一般不会有问题
而且你报错显示的明明是server[0.0.0.0:27407]
看报错像是用HTTP2去连接了一个HTTP1.1的服务器