amphp / http-client

An advanced async HTTP client library for PHP, enabling efficient, non-blocking, and concurrent requests and responses.
https://amphp.org/http-client
MIT License
704 stars 66 forks source link

TLS negotiation failed: Unknown error #317

Closed xpader closed 1 year ago

xpader commented 1 year ago

I got this error sometimes:

Amp\Http\Client\Connection\UnprocessedRequestException: The request was not processed and can be safely retried in /home/web/apps/t-task-wind/releases/145/vendor/amphp/http-client/src/Connection/DefaultConnectionFactory.php:161

Previous Amp\Http\Client\SocketException: Connection to 'example.com:443' @ '1.2.3.4:56999' closed during TLS handshake in /home/web/apps/t-task-wind/releases/145/vendor/amphp/http-client/src/Connection/DefaultConnectionFactory.php:161

Previous Amp\Socket\TlsException: TLS negotiation failed: Unknown error in /home/web/apps/t-task-wind/releases/145/vendor/amphp/socket/src/Internal/functions.php:97

in socket/src/Internal/functions.php: 97

        $result = \stream_socket_enable_crypto($socket, $enable = true);
        if ($result === false) {
            throw new TlsException('TLS negotiation failed: Unknown error');
        }

This error happened cause stream_socket_enable_crypto return false, why this happened, how can I adjust something to improve this?

bwoebi commented 1 year ago

This sounds like an error on the remote end, like the remote server closed the connection early.

This is nothing you can do anything directly about, except ... retrying.