Skip to content

Commit

Permalink
added content length header
Browse files Browse the repository at this point in the history
  • Loading branch information
a.c.van.slooten committed Dec 10, 2012
1 parent 0deeef1 commit 00faf66
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions ripcord_server.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ function __construct($services = null, $options = null, $documentor = null)
throw new Ripcord_ConfigurationException('PHP XMLRPC library is not installed',
ripcord::xmlrpcNotInstalled );
}
libxml_disable_entity_loader(); // prevents XXE attacks
$this->xmlrpc = xmlrpc_server_create();
if (isset($services))
{
Expand Down Expand Up @@ -216,7 +217,9 @@ public function run()
{
header('Content-type: text/xml');
header('Access-Control-Allow-Origin: *');
echo $this->wsdl[$query];
$wsdl = $this->wsdl[$query];
header('Content-Length: '.strlen($wsdl) );
echo $wsdl;
}
else if ( $this->documentor )
{
Expand All @@ -228,19 +231,23 @@ public function run()
// FIXME: add check for json-rpc protocol, if set and none of the xml protocols are set, use that
header('Content-type: text/xml');
header('Access-Control-Allow-Origin: *');
echo xmlrpc_encode_request(
$result = xmlrpc_encode_request(
null,
ripcord::fault( -1, 'No request xml found.' ),
$this->outputOptions
);
header('Content-Length: '.strlen( $result ) );
echo $result;
}
}
else
{
// FIXME: add check for the protocol of the request, could be json-rpc, then check if it is supported.
header('Content-type: text/xml');
header('Access-Control-Allow-Origin: *');
echo $this->handle( $request_xml );
$result = $this->handle( $request_xml );
header('Content-Length: '.strlen($result) );
echo $result;
}
}

Expand Down

0 comments on commit 00faf66

Please sign in to comment.