Search code examples
iphoneiosnginxasihttprequestuwsgi

POST data getting lost: Content Length = 0


I am randomly getting content-length = 0 errors on my server with the following setup:

iPhone POST's data synchronously using ASIFormDataRequest to the nginx proxy for UWSGI server.

The error appears randomly maybe once out of 200 requests.

I have searched for this problem but didn't find any clear answer. One of the post mentioned weird ASIHTTPRequest behavior, bug. But it's not for sure.


Solution

  • Ok, found an answer.

    There is a problem in ASIHTTPRequest with a persistant connections as described here: https://github.com/pokeb/asi-http-request/issues/94

    The workarround is to use

    [request setShouldAttemptPersistentConnection:NO];
    

    This was fixed in a newer version of the ASIHTTPRequest.