diff options
author | Daniel Lowrey <rdlowrey@php.net> | 2015-04-14 09:27:37 -0600 |
---|---|---|
committer | Daniel Lowrey <rdlowrey@php.net> | 2015-04-14 09:27:37 -0600 |
commit | 4f07330e798a4e7b12bcc1811c3c71d17b71f22c (patch) | |
tree | 2939bee1628dcf9b923c9195721008660e1a426a | |
parent | a7059f1eac383a8e42f06586d06ffd5193ed61ef (diff) | |
parent | 81f356b4aea79cd8f86e16096c7ccfbc455bfc3c (diff) | |
download | php-git-4f07330e798a4e7b12bcc1811c3c71d17b71f22c.tar.gz |
Merge branch 'PHP-5.6'
* PHP-5.6:
Fix Bug #69402: Reading empty SSL stream hangs until timeout
Conflicts:
ext/openssl/xp_ssl.c
-rw-r--r-- | ext/openssl/xp_ssl.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c index f7f6219ffb..2fbc615dd2 100644 --- a/ext/openssl/xp_ssl.c +++ b/ext/openssl/xp_ssl.c @@ -2032,10 +2032,15 @@ static size_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, siz stream->eof = (retry == 0 && errno != EAGAIN && !SSL_pending(sslsock->ssl_handle)); } + /* Don't loop indefinitely in non-blocking mode if no data is available */ + if (began_blocked == 0) { + break; + } + /* Now, if we have to wait some time, and we're supposed to be blocking, wait for the socket to become * available. Now, php_pollfd_for uses select to wait up to our time_left value only... */ - if (retry && began_blocked) { + if (retry) { if (read) { php_pollfd_for(sslsock->s.socket, (err == SSL_ERROR_WANT_WRITE) ? (POLLOUT|POLLPRI) : (POLLIN|POLLPRI), has_timeout ? &left_time : NULL); |