]> granicus.if.org Git - php/commitdiff
Fixed bug #43507 (SOAPFault HTTP Status 500 - would like to be able to set the HTTP...
authorDmitry Stogov <dmitry@php.net>
Fri, 15 Feb 2008 06:51:12 +0000 (06:51 +0000)
committerDmitry Stogov <dmitry@php.net>
Fri, 15 Feb 2008 06:51:12 +0000 (06:51 +0000)
ext/soap/soap.c

index fb9209e7627f1e9a62abf8b861fb71608bfd81cb..42a23c8891240955e301b07ac710f76165f09fba 100644 (file)
@@ -2008,6 +2008,8 @@ static void soap_server_fault_ex(sdlFunctionPtr function, zval* fault, soapHeade
        char cont_len[30];
        int size;
        xmlDocPtr doc_return;
+       zval **agent_name;
+       int use_http_error_status = 1;
 
        soap_version = SOAP_GLOBAL(soap_version);
 
@@ -2015,11 +2017,21 @@ static void soap_server_fault_ex(sdlFunctionPtr function, zval* fault, soapHeade
 
        xmlDocDumpMemory(doc_return, &buf, &size);
 
+       zend_is_auto_global("_SERVER", sizeof("_SERVER") - 1 TSRMLS_CC);
+       if (PG(http_globals)[TRACK_VARS_SERVER] &&
+               zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "HTTP_USER_AGENT", sizeof("HTTP_USER_AGENT"), (void **) &agent_name) == SUCCESS &&
+               Z_TYPE_PP(agent_name) == IS_STRING) {
+               if (strncmp(Z_STRVAL_PP(agent_name), "Shockwave Flash", sizeof("Shockwave Flash")-1) == 0) {
+                       use_http_error_status = 0;
+               }
+       }
        /*
           Want to return HTTP 500 but apache wants to over write
           our fault code with their own handling... Figure this out later
        */
-       sapi_add_header("HTTP/1.1 500 Internal Service Error", sizeof("HTTP/1.1 500 Internal Service Error")-1, 1);
+       if (use_http_error_status) {
+               sapi_add_header("HTTP/1.1 500 Internal Service Error", sizeof("HTTP/1.1 500 Internal Service Error")-1, 1);
+       }
        if (soap_version == SOAP_1_2) {
                sapi_add_header("Content-Type: application/soap+xml; charset=utf-8", sizeof("Content-Type: application/soap+xml; charset=utf-8")-1, 1);
        } else {