[En-Nut-Discussion] Duplicate code in httpd.c and ssi.c
Thiago A. Corrêa
thiago.correa at gmail.com
Wed May 14 00:28:14 CEST 2008
Hi Ole,
> > I'm having some problems with my embedded http server that was
> > working before (not sure yet the causes),
>
> Could you discriber a little what in detail does not work?
Actually it's probably non-related. I still have to figure out
what's wrong, if it was the ethernut upgrade or something else. I have
an index.html that redirects to index.asp (my code is older than the
patch that introduces index.asp as a valid default page).
So, I get to load index.html but not index.asp. Typing the cgi urls
that I have directly also doesn't help. The browser just sits there
"loading" indefinitly.
I'm trying to run my code on AVRStudio but it's crashing
AVRStudio... so, I'm waiting for the 4.14 update to download to try
again.
> > so I was looking at diffs
> > from cvs, when I stumbled uppon a duplicate function: static void
> > DestroyRequestInfo(REQUEST * req). It's implemented (in different
> > ways!) in httpd.c and ssi.c. I would like to take out the ssi one and
>
> I recently modified a little pice of code in ssi.c, but this should
> work as it does in my own application.
>
> On the other hand httpd changed some time ago and I still use the one of
> ethernut 4.4.0. So there might be introduced a bug later on.
>
Yeah, at first I thought it might be the switch from HTTP 1.0 to HTTP
1.1 and it's persistent connections. I might just change back the
defines to test that out.
> > remove the static qualifier from the one in httpd.c so it can be
> > shared between the two. This will also require moving from
> > NutHeapAlloc to malloc in ssi.c.
>
> Why you have to move from NutHeapAlloc to malloc? malloc is simply a
> wrapper to NutHeapAlloc...
I wasn't aware. But, either way, it's best practice to match
NutHeapAlloc with NutHeapFree and malloc with free instead of mixing
them up.
> Could you send me your proposed patch? I'll have a look on it and might
> better understand your problem.
My proposal isn't really to fix a problem, but just rather get rid of
a duplicate function. Should reduce code size a little bit. Anyway, I
produced a patch that I'm attaching to this mail. Will commit if
everything is in order.
Regards,
Thiago A. Correa
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.txt
Url: http://lists.egnite.de/pipermail/en-nut-discussion/attachments/20080513/7c562c55/attachment.txt
More information about the En-Nut-Discussion
mailing list