iliaa           Tue Jun 27 23:32:56 2006 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/soap   php_http.c 
    /php-src    NEWS 
  Log:
  Improved the error reporting in SOAP extension on request failure.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/soap/php_http.c?r1=1.77.2.11&r2=1.77.2.11.2.1&diff_format=u
Index: php-src/ext/soap/php_http.c
diff -u php-src/ext/soap/php_http.c:1.77.2.11 
php-src/ext/soap/php_http.c:1.77.2.11.2.1
--- php-src/ext/soap/php_http.c:1.77.2.11       Thu Apr 13 08:18:36 2006
+++ php-src/ext/soap/php_http.c Tue Jun 27 23:32:56 2006
@@ -17,7 +17,7 @@
   |          Dmitry Stogov <[EMAIL PROTECTED]>                             |
   +----------------------------------------------------------------------+
 */
-/* $Id: php_http.c,v 1.77.2.11 2006/04/13 08:18:36 dmitry Exp $ */
+/* $Id: php_http.c,v 1.77.2.11.2.1 2006/06/27 23:32:56 iliaa Exp $ */
 
 #include "php_soap.h"
 #include "ext/standard/base64.h"
@@ -237,6 +237,7 @@
        int http_status;
        int content_type_xml = 0;
        char *content_encoding;
+       char *http_msg = NULL;
        zend_bool old_allow_url_fopen;
 
        if (this_ptr == NULL || Z_TYPE_P(this_ptr) != IS_OBJECT) {
@@ -729,6 +730,14 @@
                                tmp++;
                                http_status = atoi(tmp);
                        }
+                       tmp = strstr(tmp," ");
+                       if (tmp != NULL) {
+                               tmp++;
+                               if (http_msg) {
+                                       efree(http_msg);
+                               }
+                               http_msg = estrdup(tmp);
+                       }
                        efree(http_version);
 
                        /* Try and get headers again */
@@ -842,6 +851,9 @@
                zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", 
sizeof("httpsocket"));
                zend_hash_del(Z_OBJPROP_P(this_ptr), "_use_proxy", 
sizeof("_use_proxy"));
                add_soap_fault(this_ptr, "HTTP", "Error Fetching http body, No 
Content-Length, connection closed or chunked data", NULL, NULL TSRMLS_CC);
+               if (http_msg) {
+                       efree(http_msg);
+               }
                return FALSE;
        }
 
@@ -1044,6 +1056,9 @@
                        efree(content_encoding);
                        efree(http_headers);
                        efree(http_body);
+                       if (http_msg) {
+                               efree(http_msg);
+                       }
                        add_soap_fault(this_ptr, "HTTP", "Unknown 
Content-Encoding", NULL, NULL TSRMLS_CC);
                        return FALSE;
                }
@@ -1057,6 +1072,9 @@
                        efree(http_headers);
                        efree(http_body);
                        add_soap_fault(this_ptr, "HTTP", "Can't uncompress 
compressed response", NULL, NULL TSRMLS_CC);
+                       if (http_msg) {
+                               efree(http_msg);
+                       }
                        return FALSE;
                }
                efree(content_encoding);
@@ -1087,27 +1105,16 @@
 
                if (error) {
                        efree(*buffer);
-                       if (http_status == 400) {
-                               add_soap_fault(this_ptr, "HTTP", "Bad Request", 
NULL, NULL TSRMLS_CC);
-                       } else if (http_status == 401) {
-                               add_soap_fault(this_ptr, "HTTP", "Unauthorized 
Request", NULL, NULL TSRMLS_CC);
-                       } else if (http_status == 405) {
-                               add_soap_fault(this_ptr, "HTTP", "Method not 
allowed", NULL, NULL TSRMLS_CC);
-                       } else if (http_status == 415) {
-                               add_soap_fault(this_ptr, "HTTP", "Unsupported 
Media Type", NULL, NULL TSRMLS_CC);
-                       } else if (http_status >= 400 && http_status < 500) {
-                               add_soap_fault(this_ptr, "HTTP", "Client 
Error", NULL, NULL TSRMLS_CC);
-                       } else if (http_status == 500) {
-                               add_soap_fault(this_ptr, "HTTP", "Internal 
Server Error", NULL, NULL TSRMLS_CC);
-                       } else if (http_status >= 500 && http_status < 600) {
-                               add_soap_fault(this_ptr, "HTTP", "Server 
Error", NULL, NULL TSRMLS_CC);
-                       } else {
-                               add_soap_fault(this_ptr, "HTTP", "Unsupported 
HTTP status code", NULL, NULL TSRMLS_CC);
-                       }
+                       add_soap_fault(this_ptr, "HTTP", http_msg, NULL, NULL 
TSRMLS_CC);
+                       efree(http_msg);
                        return FALSE;
                }
        }
 
+       if (http_msg) {
+               efree(http_msg);
+       }
+
        return TRUE;
 }
 
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.97&r2=1.2027.2.547.2.98&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.97 php-src/NEWS:1.2027.2.547.2.98
--- php-src/NEWS:1.2027.2.547.2.97      Tue Jun 27 08:28:24 2006
+++ php-src/NEWS        Tue Jun 27 23:32:56 2006
@@ -6,6 +6,7 @@
 - Changed realpath cache to be disabled when "open_basedir" or "safe_mode"
   are enabled on per-request basis. (Ilia)
 
+- Improved the error reporting in SOAP extension on request failure. (Ilia)
 - New crypt() implementation for win32 which is about 10 times faster and has 
   more friendly license. (Frank, Dmitry)
 - Improved performance of the implode() function on associated arrays. (Ilia)

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

Reply via email to