orcas-mkirchner / ripcord

Automatically exported from code.google.com/p/ripcord
0 stars 0 forks source link

Server bug causes methods to be called twice #4

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I was having a problem with all of my server side methods being called twice. I 
tracked it down to the "run" method in ripcord_server.php. The problematic bit 
is 

[code]          
header('Content-type: text/xml');
header('Access-Control-Allow-Origin: *');
header("Content-Length: ".strlen($this->handle( $request_xml )));
echo $this->handle( $request_xml );
[/code]

I changed it to
[code]
$handledXml = $this->handle($requestXml);
header('Content-type: text/xml');
header('Access-Control-Allow-Origin: *');
header("Content-Length: ".strlen(handledXml));
echo handledXml;
[/code]

Perhaps I was doing something wrong but it fixed my problem.

Original issue reported on code.google.com by supp...@retrojunk.com on 9 Dec 2012 at 7:25

GoogleCodeExporter commented 9 years ago
Ok, looking over my code I caused this problem in the first place by fixing the 
fact that the server does not have a "Content-Length" header. I added it but I 
also added another call to the "handle" method which caused me problems.

So the double method call is not ripcords fault but it really does need to 
report the content length in the header.

Original comment by supp...@retrojunk.com on 9 Dec 2012 at 8:02

GoogleCodeExporter commented 9 years ago
Hi,

I've basically added your code in the default run() method of the server. 
Please check if this fixes your issue.

regards,
Auke

Original comment by a...@muze.nl on 10 Dec 2012 at 12:19

GoogleCodeExporter commented 9 years ago

Original comment by a.c.van....@gmail.com on 10 Dec 2012 at 12:21