From: Daniel Lowrey Date: Thu, 7 Aug 2014 16:07:55 +0000 (-0400) Subject: Merge branch 'PHP-5.5' into PHP-5.6 X-Git-Tag: PRE_PHPNG_MERGE~17^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=98e67add15a6b889efe152c23ed15a61f022a63a;p=php Merge branch 'PHP-5.5' into PHP-5.6 * PHP-5.5: Bug #41631: Observe socket read timeouts in SSL streams Conflicts: ext/openssl/xp_ssl.c --- 98e67add15a6b889efe152c23ed15a61f022a63a diff --cc ext/openssl/xp_ssl.c index 1eed2eb485,7080a1c6b5..45b3d61d0d --- a/ext/openssl/xp_ssl.c +++ b/ext/openssl/xp_ssl.c @@@ -1796,11 -203,41 +1796,42 @@@ static size_t php_openssl_sockop_write( return didwrite; } +/* }}} */ + static void php_openssl_stream_wait_for_data(php_netstream_data_t *sock TSRMLS_DC) + { + int retval; + struct timeval *ptimeout; + + if (sock->socket == -1) { + return; + } + + sock->timeout_event = 0; + + if (sock->timeout.tv_sec == -1) + ptimeout = NULL; + else + ptimeout = &sock->timeout; + + while(1) { + retval = php_pollfd_for(sock->socket, PHP_POLLREADABLE, ptimeout); + + if (retval == 0) + sock->timeout_event = 1; + + if (retval >= 0) + break; + + if (php_socket_errno() != EINTR) + break; + } + } + -static size_t php_openssl_sockop_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) +static size_t php_openssl_sockop_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) /* {{{ */ { php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract; + php_netstream_data_t *sock; int nr_bytes = 0; if (sslsock->ssl_active) {