tony2001                Sun May 27 19:13:11 2007 UTC

  Modified files:              
    /php-src/ext/openssl        xp_ssl.c 
  Log:
  MFB: fix #41236 (Regression in timeout handling of non-blocking SSL 
connections during reads and writes).
  Everybody please calm down, we can always fix such issues without starting a 
war..
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/xp_ssl.c?r1=1.32&r2=1.33&diff_format=u
Index: php-src/ext/openssl/xp_ssl.c
diff -u php-src/ext/openssl/xp_ssl.c:1.32 php-src/ext/openssl/xp_ssl.c:1.33
--- php-src/ext/openssl/xp_ssl.c:1.32   Wed Apr  4 10:44:49 2007
+++ php-src/ext/openssl/xp_ssl.c        Sun May 27 19:13:11 2007
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: xp_ssl.c,v 1.32 2007/04/04 10:44:49 tony2001 Exp $ */
+/* $Id: xp_ssl.c,v 1.33 2007/05/27 19:13:11 tony2001 Exp $ */
 
 #include "php.h"
 #include "ext/standard/file.h"
@@ -84,7 +84,7 @@
        return 0;
 }
 
-static int handle_ssl_error(php_stream *stream, int nr_bytes TSRMLS_DC)
+static int handle_ssl_error(php_stream *stream, int nr_bytes, zend_bool 
is_init TSRMLS_DC)
 {
        php_openssl_netstream_data_t *sslsock = 
(php_openssl_netstream_data_t*)stream->abstract;
        int err = SSL_get_error(sslsock->ssl_handle, nr_bytes);
@@ -104,7 +104,7 @@
                        /* re-negotiation, or perhaps the SSL layer needs more
                         * packets: retry in next iteration */
                        errno = EAGAIN;
-                       retry = 1;
+                       retry = is_init ? 1 : sslsock->s.is_blocked;
                        break;
                case SSL_ERROR_SYSCALL:
                        if (ERR_peek_error() == 0) {
@@ -193,7 +193,7 @@
                        didwrite = SSL_write(sslsock->ssl_handle, buf, count);
 
                        if (didwrite <= 0) {
-                               retry = handle_ssl_error(stream, didwrite 
TSRMLS_CC);
+                               retry = handle_ssl_error(stream, didwrite, 0 
TSRMLS_CC); 
                        } else {
                                break;
                        }
@@ -226,7 +226,7 @@
                        nr_bytes = SSL_read(sslsock->ssl_handle, buf, count);
 
                        if (nr_bytes <= 0) {
-                               retry = handle_ssl_error(stream, nr_bytes 
TSRMLS_CC);
+                               retry = handle_ssl_error(stream, nr_bytes, 0 
TSRMLS_CC);
                                stream->eof = (retry == 0 && errno != EAGAIN && 
!SSL_pending(sslsock->ssl_handle));
                                
                        } else {
@@ -373,7 +373,7 @@
        }
 
        if (!SSL_set_fd(sslsock->ssl_handle, sslsock->s.socket)) {
-               handle_ssl_error(stream, 0 TSRMLS_CC);
+               handle_ssl_error(stream, 0, 1 TSRMLS_CC);
        }
 
        if (cparam->inputs.session) {
@@ -428,7 +428,7 @@
                        }
 
                        if (n <= 0) {
-                               retry = handle_ssl_error(stream, n TSRMLS_CC);
+                               retry = handle_ssl_error(stream, n, 1 
TSRMLS_CC); 
                        } else {
                                break;
                        }

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to