php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #61285
Patch ssl_timeout.diff revision 2012-03-05 12:08 UTC by tony2001@php.net

Patch ssl_timeout.diff for OpenSSL related Bug #61285

Patch version 2012-03-05 12:08 UTC

Return to Bug #61285 | Download this patch
Patch Revisions:

Developer: tony2001@php.net

Index: ext/openssl/xp_ssl.c
===================================================================
--- ext/openssl/xp_ssl.c	(revision 323905)
+++ ext/openssl/xp_ssl.c	(working copy)
@@ -213,6 +213,13 @@
 		int retry = 1;
 
 		do {
+			if (sslsock->s.is_blocked) {
+				php_sock_stream_wait_for_data(stream, &sslsock->s TSRMLS_CC);
+				if (sslsock->s.timeout_event) {
+					break;
+				}
+			}
+
 			nr_bytes = SSL_read(sslsock->ssl_handle, buf, count);
 
 			if (nr_bytes <= 0) {
Index: main/php_network.h
===================================================================
--- main/php_network.h	(revision 323905)
+++ main/php_network.h	(working copy)
@@ -299,6 +299,7 @@
 
 PHPAPI int php_network_parse_network_address_with_port(const char *addr,
 		long addrlen, struct sockaddr *sa, socklen_t *sl TSRMLS_DC);
+PHPAPI void php_sock_stream_wait_for_data(php_stream *stream, php_netstream_data_t *sock TSRMLS_DC);
 END_EXTERN_C()
 
 #define php_stream_sock_open_from_socket(socket, persistent)	_php_stream_sock_open_from_socket((socket), (persistent) STREAMS_CC TSRMLS_CC)
Index: main/streams/xp_socket.c
===================================================================
--- main/streams/xp_socket.c	(revision 323905)
+++ main/streams/xp_socket.c	(working copy)
@@ -111,7 +111,7 @@
 	return didwrite;
 }
 
-static void php_sock_stream_wait_for_data(php_stream *stream, php_netstream_data_t *sock TSRMLS_DC)
+PHPAPI void php_sock_stream_wait_for_data(php_stream *stream, php_netstream_data_t *sock TSRMLS_DC)
 {
 	int retval;
 	struct timeval *ptimeout;
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 28 19:01:28 2024 UTC