@@ -1807,59 +1807,13 @@ static size_t php_openssl_sockop_write(php_stream *stream, const char *buf, size
1807
1807
}
1808
1808
/* }}} */
1809
1809
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
-
1840
1810
static size_t php_openssl_sockop_read (php_stream * stream , char * buf , size_t count TSRMLS_DC ) /* {{{ */
1841
1811
{
1842
1812
php_openssl_netstream_data_t * sslsock = (php_openssl_netstream_data_t * )stream -> abstract ;
1843
- php_netstream_data_t * sock ;
1844
1813
int nr_bytes = 0 ;
1845
1814
1846
1815
if (sslsock -> ssl_active ) {
1847
1816
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
- }
1863
1817
1864
1818
do {
1865
1819
nr_bytes = SSL_read (sslsock -> ssl_handle , buf , count );
0 commit comments