Must really be safe_read(), not full_read()? (was: [PATCH] fix httpd lockup in cgi POSTs)

Paul Albrecht albrecht at rdi1.com
Mon Feb 12 15:25:09 UTC 2007


Reverting the code back to using safe_read doesn't work if you don't fix
the way the first line is handled because you're not guaranteed a full
line with the safe_read.

You can verify this by writing a cgi program which redirects to another
location.

It will intermittently fail. This has nothing to do with how the cgi
program writes to standard output. It's a consequence of the fact that
the server doesn't buffer standard input so it has no right to expect a
full line with its first read of cgi output.

An expedient way to fix the problem is to do the full_read, that is,
receive all the cgi output before handling the first line.

If this is not sufficient then busybox httpd should line buffer standard
input so that it always handles the status line correctly. 

Paul Albrecht



More information about the busybox mailing list