Bug in bb 1.3.1, httpd with POST

Denis Vlasenko vda.linux at googlemail.com
Sun Feb 11 18:34:01 UTC 2007


On Sunday 11 February 2007 17:27, Alexander Griesser wrote:
> Denis Vlasenko wrote:
> > I would like to try it myself. Do you have a small testcase?
> 
> Well, I have this cgi-script that I built to try it out.
> 
> test.cgi:
> ------------------- 8< -------------------
> #!/bin/sh
> 
> echo "<html>
> <body>
> <form method="post" action="/cgi-bin/test.cgi">
> <input type="text" name="test">
> <input type="submit" name="submit">
> </form>"
> 
> if [ "$REQUEST_METHOD" = "POST" ]; then
>   # This doesn't work at all, it hangs with this
>   read QUERY_STRING
>   echo $QUERY_STRING
> 
>   # This does only work, if the destination file has
>   # already been created before, don't know why, but
>   # I debugged this fact yesterday and it is reproducible
>   # If the file is not available when cat tries to write
>   # the data to it, it hangs as `read` does in the above
>   # lines
>   cat >/tmp/query
>   cat /tmp/query
> fi
> 
> echo "</body>
> </html>"
> ------------------- 8< -------------------
> 
> I hope, this is what you meant with "testcase". If not, please tell
> me what I need to provide so that you can reproduce it.

Yes. Generally it's always better to explain problems
with exact details, not with somewhat vague descriptions.

I think I know where is the problem.

networking/httpd.c: replace

                close(config->accepted_socket);
                close(config->server_socket);

with

                if (config->accepted_socket > 1)
                        close(config->accepted_socket);
                if (config->server_socket > 1)
                        close(config->server_socket);

Does it work now?
--
vda



More information about the busybox mailing list