[En-Nut-Discussion] HTTP QueryString parser

Mikael Adolfsson ethernut at ma.stendahls.net
Wed Sep 10 23:19:14 CEST 2003


Hi,

hmm, interesting. Since you get the right number of parameters, it sounds 
like there isn't enough memory left on the stack. Also, if there aren't 
enough memory on the heap, the parser will stop, and 
NutHttpGetParameterCount will allways return 0.

I'm not sure how much memory is required on the stack, but at least it 
uses very little memory on the heap. Try allocating more stack.

When the query string is parsed, the req->req_query property is
overwritten with the parsed data, since the decoded content is allways
less or equal the size of req_query (and I guess most users don't need the
req_query after that). The only extra allocated memory in the heap are two
times the number of parameters in the query string.

I just noted also that I'm using register hints on the local variables. 
Maybe there's a compiler issue here. What compiler/version do you use? 
I'm using avr-gcc 3.3(20030421).

Btw, how long is your querystring in total?  Request method+requested
file+parameters+version may not be longer than 256 chars.

/ Mikael

On Wed, 10 Sep 2003, Lars Andersson wrote:
> Hi Mikael,
> 
> Sorry for not being specific on the version and HW. I am using Nut/OS
> 3.3 on a rev-d board.
>
> I have found out that the "NutHttpGetParameterCount" function works fine
> and returns the correct number of parameters. It seams that the mpu
> makes weird things inside the loop. The output is different for the same
> query string.
>
> I have used the httpd.c and httpd.h files and not patched anything.
>
> Do you have any clue on how much memory this process requires compared
> to the original code. Could it be that I have not dedicated enough
> memory when starting the thread dong the processing?
> 
> I'll try this code in a simpler application than I am working on right
> now and see what happens.




More information about the En-Nut-Discussion mailing list