tony2001                Wed Mar 14 19:22:14 2007 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src    NEWS 
    /php-src/ext/openssl        xp_ssl.c 
  Log:
  MFH: fix #40750 (openssl stream wrapper ignores default_stream_timeout)
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.592&r2=1.2027.2.547.2.593&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.592 php-src/NEWS:1.2027.2.547.2.593
--- php-src/NEWS:1.2027.2.547.2.592     Wed Mar 14 16:36:16 2007
+++ php-src/NEWS        Wed Mar 14 19:22:14 2007
@@ -29,6 +29,8 @@
 - Fixed bug #40754 (added substr() & substr_replace() overflow checks). (Ilia)
 - Fixed bug #40752 (parse_ini_file() segfaults when a scalar setting is 
   redeclared as an array). (Tony)
+- Fixed bug #40750 (openssl stream wrapper ignores default_stream_timeout). 
+  (Tony)
 - Fixed bug #40727 (segfault in PDO when failed to bind parameters). (Tony)
 - Fixed bug #40709 (array_reduce() behaves strange with one item stored 
arrays).
   (Ilia)
http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/xp_ssl.c?r1=1.22.2.3.2.5&r2=1.22.2.3.2.6&diff_format=u
Index: php-src/ext/openssl/xp_ssl.c
diff -u php-src/ext/openssl/xp_ssl.c:1.22.2.3.2.5 
php-src/ext/openssl/xp_ssl.c:1.22.2.3.2.6
--- php-src/ext/openssl/xp_ssl.c:1.22.2.3.2.5   Mon Jan  1 09:36:04 2007
+++ php-src/ext/openssl/xp_ssl.c        Wed Mar 14 19:22:14 2007
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: xp_ssl.c,v 1.22.2.3.2.5 2007/01/01 09:36:04 sebastian Exp $ */
+/* $Id: xp_ssl.c,v 1.22.2.3.2.6 2007/03/14 19:22:14 tony2001 Exp $ */
 
 #include "php.h"
 #include "ext/standard/file.h"
@@ -47,6 +47,7 @@
 typedef struct _php_openssl_netstream_data_t {
        php_netstream_data_t s;
        SSL *ssl_handle;
+       struct timeval connect_timeout;
        int enable_on_connect;
        int is_client;
        int ssl_active;
@@ -390,7 +391,7 @@
        int n, retry = 1;
 
        if (cparam->inputs.activate && !sslsock->ssl_active) {
-               float timeout = sslsock->s.timeout.tv_sec + 
sslsock->s.timeout.tv_usec / 1000000;
+               float timeout = sslsock->connect_timeout.tv_sec + 
sslsock->connect_timeout.tv_usec / 1000000;
                int blocked = sslsock->s.is_blocked;
 
                if (!sslsock->state_set) {
@@ -608,7 +609,7 @@
                                                tv.tv_sec = 
FG(default_socket_timeout);
                                                tv.tv_usec = 0;
                                        } else {
-                                               tv = sslsock->s.timeout;
+                                               tv = sslsock->connect_timeout;
                                        }
                                } else {
                                        tv.tv_sec = value;
@@ -766,8 +767,13 @@
        memset(sslsock, 0, sizeof(*sslsock));
 
        sslsock->s.is_blocked = 1;
-       sslsock->s.timeout.tv_sec = timeout->tv_sec;
-       sslsock->s.timeout.tv_usec = timeout->tv_usec;
+       /* this timeout is used by standard stream funcs, therefor it should 
use the default value */
+       sslsock->s.timeout.tv_sec = FG(default_socket_timeout);
+       sslsock->s.timeout.tv_usec = 0;
+
+       /* use separate timeout for our private funcs */
+       sslsock->connect_timeout.tv_sec = timeout->tv_sec;
+       sslsock->connect_timeout.tv_usec = timeout->tv_usec;
 
        /* we don't know the socket until we have determined if we are binding 
or
         * connecting */

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

Reply via email to