Bug in bb 1.4.2, httpd with POST

Denis Vlasenko vda.linux at googlemail.com
Sun Mar 25 13:04:58 PDT 2007


On Sunday 25 March 2007 18:02, Dirk Clemens wrote:
> POST dosn't work in bb 1.4.2.
> I get no error message, but the input stream is always empty.

cgi-bin/post.cgi:

#!/bin/sh
echo "`date '+%Y-%m-%d %H%M%S'` start" >>log
echo "<html>
<body>
<form method="post" action="/cgi-bin/post.cgi">
<input type="text" name="test">
<input type="submit" name="submit">
</form>"
echo "`date '+%Y-%m-%d %H%M%S'` if" >>log
if [ "$REQUEST_METHOD" = "POST" ]; then
    read QUERY_STRING
    echo "`date '+%Y-%m-%d %H%M%S'` got '$QUERY_STRING'" >>log
    printf "%s\n" "$QUERY_STRING"
fi
echo "`date '+%Y-%m-%d %H%M%S'` if ended" >>log
echo "</body>
</html>"
echo "`date '+%Y-%m-%d %H%M%S'` exiting" >>log

I open http://127.0.0.1:81/cgi-bin/post.cgi. I see the input field.
I enter "ABC". This page appears:

[............] [Submit Query]

test=ABC&submit=Submit+Query

log file:
2007-03-25 220047 start
2007-03-25 220047 if
2007-03-25 220047 if ended
2007-03-25 220047 exiting
2007-03-25 220051 start
2007-03-25 220051 if
2007-03-25 220051 got 'test=ABC&submit=Submit+Query'
2007-03-25 220051 if ended
2007-03-25 220051 exiting

Thus POST isn't COMPLETELY broken, it works at least for SOME scripts.

Obviously you have an example where it breaks horribly. Please share it.

(or maybe 1.4.2 really doesn't work. I tested 1.5.0)
--
vda


More information about the busybox mailing list