File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -387,12 +387,19 @@ public function baseRead($socket, $check_eof = true)
387
387
{
388
388
// SSL handshake.
389
389
if ($ this ->transport === 'ssl ' && $ this ->_sslHandshakeCompleted !== true ) {
390
- stream_set_blocking ($ socket , true );
391
- stream_set_timeout ($ socket , 1 );
392
390
$ ret = stream_socket_enable_crypto ($ socket , true , STREAM_CRYPTO_METHOD_SSLv23_SERVER);
393
- if (!$ ret ) {
394
- echo new \Exception ('ssl handshake fail, stream_socket_enable_crypto return ' . var_export ($ ret , true ));
391
+ // Negotiation has failed.
392
+ if (false === $ ret ) {
393
+ $ error = error_get_last ();
394
+ $ error_msg = '' ;
395
+ if ($ error ) {
396
+ $ error_msg = "{$ error ['message ' ]} in {$ error ['file ' ]} on line {$ error ['line ' ]}" ;
397
+ }
398
+ echo new \Exception ("SSL handshake fail $ error_msg " );
395
399
return $ this ->destroy ();
400
+ } elseif (0 === $ ret ) {
401
+ // There isn't enough data and should try again.
402
+ return ;
396
403
}
397
404
if (isset ($ this ->onSslHandshake )) {
398
405
try {
You can’t perform that action at this time.
0 commit comments