Busybox httpd sends output of stderr to the Website

Dirk Lohse d.lohse at meier-nt.de
Tue Mar 21 16:37:42 UTC 2017


Hi,

when i run some cgi's with BusyBox internal httpd and there is some code that writes to stdout I get the result on the HTTP site - which is desired - because I produce HTTP-code within this cgi scripts. The output of stderr instead should not destroy my HTML-code and could be redirected to /dev/null.

In BusyBox v1.19.4 all was fine. But on BusyBox version v1.20.2 httpd redirects output from stdout + stderr to the HTML-code.

I've written a small test script to check this behavior on both versions:

test.cgi:
#!/bin/sh

echo "Content-Type: text/plain"
echo "Expires: 0"
echo

echo "Hello World!"
echo "You should not see this text in your Browser" >&2

when I call this script on the older version, I only see "Hello World!", on the new version instead I see also the last line.

I've many code and libraries where everywhere an error message or warning could happen on stdout. So changing all the code is nearly impossible, and some warnings like "can't open file..." are necessary for debugging.

My question: How can I tell the httpd to NOT redirect stdout to the website?

Thanks,
Dirk




More information about the busybox mailing list