[En-Nut-Discussion] HTTP QueryString parser
Lars Andersson
laran at ikp.liu.se
Mon Sep 15 10:09:10 CEST 2003
Mikael,
I have now made the changes to the code and it seems to work fine now.
Thank you very much for the contribution of your solution. I think this will make implementation easier in the future!
If I notice other strange results from your code I'll get back to you :)
By the way, can you please explain, in more detail, the usage of these functions. I looked in the header file but unfortunately that didn't explain it to me.
char *NutHttpURLEncode (char *str);
void NutHttpURLDecode (char *str);
Regards,
/Lars A. A.
-----Original Message-----
From: Mikael Adolfsson [mailto:ma at stendahls.net]
Sent: den 13 september 2003 10:00
To: en-nut-discussion at egnite.de
Subject: RE: [En-Nut-Discussion] HTTP QueryString parser
Lars,
I've found the bug.
The NutHttpProcessQueryString allocated too little memory.
At row 329 in httpd.c change from
req->req_qptrs = (char **)NutHeapAllocClear(sizeof(char
*)*req->req_numqptrs);
to
req->req_qptrs = (char **)NutHeapAllocClear(sizeof(char
*)*req->req_numqptrs*2);
(double the memory - ofcourse it needs space for a pointer to the param
name and one for the value.)
/ Mikael
On Fri, 12 Sep 2003, Lars Andersson wrote:
> Mikael,
>
> I use the same compiler version as you. The query string is also less
> than 256 chars.
>
> I tried to implement similar code to what I explained earlier into the
> httpd example that comes with the NUT/OS distribution. At first it
> seemed to work fine, but after a while I noticed that the system was
> very unstable. It seems that the connection is never closed.
>
> Could there be some memory leak?
>
> /Lars A Andersson
_______________________________________________
En-Nut-Discussion mailing list
En-Nut-Discussion at egnite.de
http://www.egnite.de/mailman/listinfo/en-nut-discussion
More information about the En-Nut-Discussion
mailing list