CocoaHTTPServer version 2.0 - POST

240 views
Skip to first unread message

danny

unread,
Jan 11, 2011, 10:15:58 AM1/11/11
to CocoaHTTPServer
Hi,

I migrated my existing app to use cocoaHTTPServer 2 and I'm having
issues with processing large POSTs. In simulator if I try uploading a
small file things seem to work fine. However when I try uploading a
large file it starts hanging after a random number of
processPostDataChunk.

I'm basically using the iPhoneHTTPServer3 example with some patches
here and there... but everything worked fine with the previous
cocoaHTTPServer.

I'm wondering if this is a known issue, and if there is anything I
should look into before giving up and reverting back to the previous
server version. Has anyone done any large POSTs successfully?

TIA

Robbie Hanson

unread,
Jan 18, 2011, 8:45:47 AM1/18/11
to cocoaht...@googlegroups.com
How are you storing the post data chunks? If the post data is large, and you are appending the data to the response (HTTPMessage), you are attempting to store the data in RAM. On the simulator you might not run into any problems, but on the device you will likely run out of memory quickly (with a large post).

-Robbie Hanson
Sent from my iPhone

> --
> You received this message because you are subscribed to the Google Groups "CocoaHTTPServer" group.
> To post to this group, send email to cocoaht...@googlegroups.com.
> To unsubscribe from this group, send email to cocoahttpserv...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/cocoahttpserver?hl=en.
>

Danny Babiy

unread,
Jan 18, 2011, 10:04:15 AM1/18/11
to cocoaht...@googlegroups.com
My implementation is based on iPhoneHTTPServer3 example, which writes post chunks to disk. Everything works without any issues with the previous cocoaHTTPServer version.

Robbie Hanson

unread,
Jan 18, 2011, 11:57:26 AM1/18/11
to cocoaht...@googlegroups.com
There are currently no known issues with uploads.  Can you provide more information about the problems you are having?  Have you tried enabling verbose logging in the HTTPConnection class?  Would you be able to provide any code samples?

-Robbie Hanson

Danny Babiy

unread,
Jan 18, 2011, 2:02:24 PM1/18/11
to cocoaht...@googlegroups.com
Sending the attachment to you directly since the group doesn't allow attachments

Stevo Brock

unread,
Jan 18, 2011, 2:54:06 PM1/18/11
to cocoaht...@googlegroups.com
Jumping in here.

We are seeing the exact same situation here with "largish" POSTs.  Previous version works like a charm.  Current version hangs at a certain point during the transfer.  In our environment, we have the server running on Mac OS X 10.6.5 with client code running on an iPod Touch 4 and iPhone 4.  Incoming POST data is being stored to a file.

In our case, data on the order of 4K goes through OK, but data on the order of a few hundred K gets stuck.

-Stevo

Robbie Hanson

unread,
Jan 18, 2011, 4:11:14 PM1/18/11
to cocoaht...@googlegroups.com
I've just discovered the bug.  It is a bug in GCDAsyncSocket.  Applying fix now...

-Robbie Hanson

Robbie Hanson

unread,
Jan 18, 2011, 4:18:05 PM1/18/11
to cocoaht...@googlegroups.com
Just pushed the bug fix.  Thanks for reporting the issue.  Let me know...

-Robbie Hanson



On Jan 18, 2011, at 2:54 PM, Stevo Brock wrote:

Stevo Brock

unread,
Jan 18, 2011, 6:11:15 PM1/18/11
to cocoaht...@googlegroups.com
Hi Robbie,

Thanks so much for looking into this.  I just downloaded the latest code and it seems to be working great!

-Stevo
Reply all
Reply to author
Forward
0 new messages