Skip to content

Commit feadaae

Browse files
committed
Revert "Merge branch 'PHP-5.5' into PHP-5.6"
This reverts commit 98e67ad, reversing changes made to 2cdc1a2.
1 parent 4fb998d commit feadaae

File tree

1 file changed

+0
-46
lines changed

1 file changed

+0
-46
lines changed

ext/openssl/xp_ssl.c

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1807,59 +1807,13 @@ static size_t php_openssl_sockop_write(php_stream *stream, const char *buf, size
18071807
}
18081808
/* }}} */
18091809

1810-
static void php_openssl_stream_wait_for_data(php_netstream_data_t *sock TSRMLS_DC)
1811-
{
1812-
int retval;
1813-
struct timeval *ptimeout;
1814-
1815-
if (sock->socket == -1) {
1816-
return;
1817-
}
1818-
1819-
sock->timeout_event = 0;
1820-
1821-
if (sock->timeout.tv_sec == -1)
1822-
ptimeout = NULL;
1823-
else
1824-
ptimeout = &sock->timeout;
1825-
1826-
while(1) {
1827-
retval = php_pollfd_for(sock->socket, PHP_POLLREADABLE, ptimeout);
1828-
1829-
if (retval == 0)
1830-
sock->timeout_event = 1;
1831-
1832-
if (retval >= 0)
1833-
break;
1834-
1835-
if (php_socket_errno() != EINTR)
1836-
break;
1837-
}
1838-
}
1839-
18401810
static size_t php_openssl_sockop_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) /* {{{ */
18411811
{
18421812
php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract;
1843-
php_netstream_data_t *sock;
18441813
int nr_bytes = 0;
18451814

18461815
if (sslsock->ssl_active) {
18471816
int retry = 1;
1848-
sock = (php_netstream_data_t*)stream->abstract;
1849-
1850-
/* The SSL_read() function will block indefinitely waiting for data on a blocking
1851-
socket. If we don't poll for readability first this operation has the potential
1852-
to hang forever. To avoid this scenario we poll with a timeout before performing
1853-
the actual read. If it times out we're finished.
1854-
*/
1855-
if (sock->is_blocked) {
1856-
php_openssl_stream_wait_for_data(sock);
1857-
if (sock->timeout_event) {
1858-
stream->eof = 1;
1859-
php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSL read operation timed out");
1860-
return nr_bytes;
1861-
}
1862-
}
18631817

18641818
do {
18651819
nr_bytes = SSL_read(sslsock->ssl_handle, buf, count);

0 commit comments

Comments
 (0)