[php-src] PR #24132: Fix TLS stream EOF detection after close_notify with stale errno
| From: | bukka | Date: | Mon, 05 Oct 2026 08:35:01 +0000 |
| Subject: | [php-src] PR #24132: Fix TLS stream EOF detection after close_notify with stale errno | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-39155@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/24132
Author: bukka
php_openssl_handle_ssl_error() sets errno to EAGAIN on SSL_ERROR_WANT_READ and SSL_ERROR_WANT_WRITE,
and php_openssl_sockop_io() reads it back to avoid marking a non-blocking read that needs to wait as
EOF. OpenSSL resets errno before every recv() on POSIX systems, but on Windows it uses the Winsock
error state instead and never touches errno, so the EAGAIN stays set across every later successful
read. A close_notify received afterwards returned SSL_ERROR_ZERO_RETURN but did not set
stream->eof, and feof() stayed false while the TCP connection was still open.
Decide EOF from the SSL error code, which already says whether the operation just needs to wait,
instead of from errno.