Issues

ZF-12013: Zend_XmlRpc_Server_Fault doesn't return Content-type text/xml (the default Zend_XmlRpc_Response_Http response)

Description

If the server raises an xmlrpc fault, the response is not a default Zend_XmlRpc_Response_Http response. Thus, the content-type: text/xml headers are not set by default, in contrary to all other successful responses.

See this telnet session where I deliberately generate a faulty response:

patrick@vm:~/www_plugins/zend_framework/Zend/XmlRpc$ telnet contact.host.nl 80 Trying X.X.X.37... Connected to host.nl. Escape character is '^]'. POST /api/v1.0/xmlrpc HTTP/1.1 Host: contact.host.nl Connection: keep-alive Content-Type: text/xml Content-Length: 149

<?xml version="1.0"?>getTestData1111111111111111111ZZ HTTP/1.1 200 OK Date: Thu, 19 Jan 2012 21:28:10 GMT Server: Apache/2.2.9 (Debian) DAV/2 SVN/1.5.1 PHP/5.2.6-1+lenny13 with Suhosin-Patch mod_ssl/2.2.9 OpenSSL/0.9.8g X-Powered-By: PHP/5.2.6-1+lenny13 Content-Length: 283 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Content-Type: text/html --> NOT A DEFAULT text/xml response

<?xml version="1.0" encoding="UTF-8"?> faultCode631faultStringFailed to parse request

When I look at Zend/XmlRpc/Server.php I think it has to do with this function:

{quote} /** * Raise an xmlrpc server fault * * @param string|Exception $fault * @param int $code * @return Zend_XmlRpc_Server_Fault */ public function fault($fault = null, $code = 404) { if (!$fault instanceof Exception) { $fault = (string) $fault; if (empty($fault)) { $fault = 'Unknown Error'; } require_once 'Zend/XmlRpc/Server/Exception.php'; $fault = new Zend_XmlRpc_Server_Exception($fault, $code); }

    return Zend_XmlRpc_Server_Fault::getInstance($fault);
}

{quote} Just like in the protected function _handle I think there has to be checked which response class to use: $responseClass = $this->getResponseClass(); return new $responseClass($return);

Greetings, Patrick

Comments

No comments to display