From 21205c0ca0b25c372f0666f51280fe0a3fb5addc Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Fri, 15 Feb 2008 06:51:41 +0000 Subject: [PATCH] Fixed bug #43507 (SOAPFault HTTP Status 500 - would like to be able to set the HTTP Status) --- ext/soap/soap.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 5e5e510b2d..8f2210b76c 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -2382,6 +2382,8 @@ static void soap_server_fault_ex(sdlFunctionPtr function, zval* fault, soapHeade int size; xmlDocPtr doc_return; UConverter *old_runtime_conv, *old_output_conv; + zval **agent_name; + int use_http_error_status = 1; soap_version = SOAP_GLOBAL(soap_version); @@ -2389,11 +2391,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_ascii_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 (zend_ini_long("zlib.output_compression", sizeof("zlib.output_compression"), 0)) { sapi_add_header("Connection: close", sizeof("Connection: close")-1, 1); } else { -- 2.50.1