dmitry          Fri Nov 28 14:20:58 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src    NEWS 
    /php-src/ext/soap   php_http.c 
  Log:
  Fixed bug #41534 (SoapClient over HTTPS fails to reestablish connection)
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.392&r2=1.2027.2.547.2.965.2.393&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.392 
php-src/NEWS:1.2027.2.547.2.965.2.393
--- php-src/NEWS:1.2027.2.547.2.965.2.392       Thu Nov 27 19:01:18 2008
+++ php-src/NEWS        Fri Nov 28 14:20:57 2008
@@ -93,6 +93,8 @@
   (David C.)
 - Fixed bug #44154 (pdo->errorInfo() always have three elements in the
   returned array). (David C.)
+- Fixed bug #41534 (SoapClient over HTTPS fails to reestablish connection).
+  (Dmitry)
 
 
 02 Sep 2008, PHP 5.3.0 Alpha 2
http://cvs.php.net/viewvc.cgi/php-src/ext/soap/php_http.c?r1=1.77.2.11.2.12.2.6&r2=1.77.2.11.2.12.2.7&diff_format=u
Index: php-src/ext/soap/php_http.c
diff -u php-src/ext/soap/php_http.c:1.77.2.11.2.12.2.6 
php-src/ext/soap/php_http.c:1.77.2.11.2.12.2.7
--- php-src/ext/soap/php_http.c:1.77.2.11.2.12.2.6      Wed Oct  1 13:13:34 2008
+++ php-src/ext/soap/php_http.c Fri Nov 28 14:20:58 2008
@@ -17,7 +17,7 @@
   |          Dmitry Stogov <[EMAIL PROTECTED]>                             |
   +----------------------------------------------------------------------+
 */
-/* $Id: php_http.c,v 1.77.2.11.2.12.2.6 2008/10/01 13:13:34 dmitry Exp $ */
+/* $Id: php_http.c,v 1.77.2.11.2.12.2.7 2008/11/28 14:20:58 dmitry Exp $ */
 
 #include "php_soap.h"
 #include "ext/standard/base64.h"
@@ -31,30 +31,6 @@
 #define smart_str_append_const(str, const) \
        smart_str_appendl(str,const,sizeof(const)-1)
 
-static int stream_alive(php_stream *stream  TSRMLS_DC)
-{
-       int socket;
-       char buf;
-
-       /* maybe better to use:
-        * php_stream_set_option(stream, PHP_STREAM_OPTION_CHECK_LIVENESS, 0, 
NULL)
-        * here instead */
-
-       if (stream == NULL || stream->eof || php_stream_cast(stream, 
PHP_STREAM_AS_FD_FOR_SELECT, (void**)&socket, 0) != SUCCESS) {
-               return FALSE;
-       }
-       if (socket == -1) {
-               return FALSE;
-       } else {
-               if (php_pollfd_for_ms(socket, PHP_POLLREADABLE, 0) > 0) {
-                       if (0 == recv(socket, &buf, sizeof(buf), MSG_PEEK) && 
php_socket_errno() != EAGAIN) {
-                               return FALSE;
-                       }
-               }
-       }
-       return TRUE;
-}
-
 /* Proxy HTTP Authentication */
 void proxy_authentication(zval* this_ptr, smart_str* soap_headers TSRMLS_DC)
 {
@@ -364,7 +340,7 @@
        }
 
        /* Check if keep-alive connection is still opened */
-       if (stream != NULL && !stream_alive(stream TSRMLS_CC)) {
+       if (stream != NULL && php_stream_eof(stream)) {
                php_stream_close(stream);
                zend_hash_del(Z_OBJPROP_P(this_ptr), "httpurl", 
sizeof("httpurl"));
                zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", 
sizeof("httpsocket"));
@@ -909,6 +885,7 @@
                efree(cookie);
        }
 
+       /* See if the server requested a close */
        if (http_1_1) {
                http_close = FALSE;
                if (use_proxy && !use_ssl) {
@@ -920,8 +897,35 @@
                                efree(connection);
                        }
                }
+               if (http_close == FALSE) {
+                       connection = 
get_http_header_value(http_headers,"Connection: ");
+                       if (connection) {
+                               if (strncasecmp(connection, "close", 
sizeof("close")-1) == 0) {
+                                       http_close = TRUE;
+                               }
+                               efree(connection);
+                       }
+               }
        } else {
                http_close = TRUE;
+               if (use_proxy && !use_ssl) {
+                       connection = 
get_http_header_value(http_headers,"Proxy-Connection: ");
+                       if (connection) {
+                               if (strncasecmp(connection, "Keep-Alive", 
sizeof("Keep-Alive")-1) == 0) {
+                                       http_close = FALSE;
+                               }
+                               efree(connection);
+                       }
+               }
+               if (http_close == TRUE) {
+                       connection = 
get_http_header_value(http_headers,"Connection: ");
+                       if (connection) {
+                               if (strncasecmp(connection, "Keep-Alive", 
sizeof("Keep-Alive")-1) == 0) {
+                                       http_close = FALSE;
+                               }
+                               efree(connection);
+                       }
+               }
        }       
 
        if (!get_http_body(stream, http_close, http_headers, &http_body, 
&http_body_size TSRMLS_CC)) {
@@ -940,31 +944,6 @@
 
        if (request != buf) {efree(request);}
 
-       /* See if the server requested a close */
-       http_close = TRUE;
-       connection = get_http_header_value(http_headers,"Proxy-Connection: ");
-       if (connection) {
-               if (strncasecmp(connection, "Keep-Alive", 
sizeof("Keep-Alive")-1) == 0) {
-                       http_close = FALSE;
-               }
-               efree(connection);
-/*
-       } else if (http_1_1) {
-               http_close = FALSE;
-*/
-       }
-       connection = get_http_header_value(http_headers,"Connection: ");
-       if (connection) {
-               if (strncasecmp(connection, "Keep-Alive", 
sizeof("Keep-Alive")-1) == 0) {
-                       http_close = FALSE;
-               }
-               efree(connection);
-/*
-       } else if (http_1_1) {
-               http_close = FALSE;
-*/
-       }
-
        if (http_close) {
                php_stream_close(stream);
                zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", 
sizeof("httpsocket"));



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

Reply via email to