Page 1 of 1

Handling large POST data (Mod5282)

Posted: Wed Feb 13, 2013 2:57 am
by res
Good morning,

I'm sorry in advance that I have missed some trivial piece of information, but I have got stuck on following issue:

I have an application (on Mod5282) with a simple web configuration interface. So far I have got by with HTTP GET methods for passing parameters, but now I need the web interface to upload a larger chunk of data (typically 10kB, let's say up to 50kB) from a form (with TEXTAREA) via the POST method.

I have defined a POST wrapper:

Code: Select all

int PostWrap( int sock, char *url, char *pData, char *rxBuffer )
{
   iprintf("----- Processing Post -----\r\n");
   iprintf("Post URL: %s\r\n", url);
   RedirectResponse( sock, "batch.htm" );
   return 1;
}
... and registered it:

Code: Select all

	SetNewPostHandler( PostWrap );
When I try to upload a few lines it works fine -- the PostWrap() prints the url and the user is redirected to proper page.

But, when I try to submit 5kB of text, the connection times out and there is no output from PostWrap(). The firmware seemingly carries on i.e. the http server responds to other queries and other tasks do their job.

I assume, that I am over-running some buffer anywhere ... if I am right, the question is how can I increase that buffer and even better without altering the system libraries (since I don't want this to interfere with another projects).

Thank you in advance, hope this will be long question-short answer issue :)
Simon

Re: Handling large POST data (Mod5282)

Posted: Wed Feb 13, 2013 2:12 pm
by rnixon
Not an expert here, but I think you need to use multipart forms. There is an example in the \nburn\examples\web for uploading an application file. If I remember correctly, the issue is you need to allocate a static buffer big enough to hold your largest file size, so its disabled by default to conserve memory.

Re: Handling large POST data (Mod5282)

Posted: Fri Feb 15, 2013 12:56 am
by res
Yes, this could be the way, nonetheless the multipart forms are useful for uploading a file, not for large data from user inputs :/

Re: Handling large POST data (Mod5282)

Posted: Sat Feb 16, 2013 7:41 am
by pbreed
Actually the mutipart forms changes the post buffering so it will probably fix you issues as well....


Another way to do this is to edit the variable in nburn\include\constants.h

#define HTTP_RX_BUFFERSIZE (10000)

Make it bigger than recompile the system directory (rebuild all from eclipse)

Paul