Repository navigation
Commit 614c628
authored
Fix TLS stream EOF detection after close_notify with stale errno (#24132)
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.1 parent aaa8707 commit 614c628
3 files changed
Lines changed: 64 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| 123 | + | |
| 124 | + | |
123 | 125 | | |
124 | 126 | | |
125 | 127 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2186 | 2186 | | |
2187 | 2187 | | |
2188 | 2188 | | |
2189 | | - | |
2190 | 2189 | | |
2191 | | - | |
| 2190 | + | |
| 2191 | + | |
| 2192 | + | |
| 2193 | + | |
2192 | 2194 | | |
2193 | 2195 | | |
2194 | 2196 | | |
| |||
0 commit comments