I’m seeing error logs caused by what appears to be truncation of the post data. After debugging, my guess is that the issue is that we’re using an xmlhttprequest to do the post, and the user is closing the browser before the entirety of the post data has been sent.
Here’s our js code:
httpReq = new XMLHttpRequest();
httpReq.open("POST", url,false);
httpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
httpReq.send(param);
Is there a way to detect an incomplete send on the PHP side other than finding out there are missing post parameters? (Which we can’t do since they’re dynamic.)
2011-02-27 Edit:
As an example, the client is sending something like:
&obj1_name=Greeting&obj1_type=string&obj1_value=hello&obj1_id=34
The obj1_id is a required field in order to store the remaining details about the object. But sometimes we receive a string like:
&obj1_name=Greeting&obj1_type=string
My goal is to tell the difference between a broken client (one where it meant to send the short string) that we need to fix, and a working client that was closed too early (one where it meant to send the long string) and we can write off the error as unavoidable.
I’ve realized we simply need more info from the client in order to do this.
To accomplish this, we’ve added a known termination value on the client end. If that final parameter isn’t set when the server sees it, it was an incomplete submission.