I have a small cgi script that fetches and validates a configuration file for Nagios. The typical run time is several minutes, and I would like to get some feedback in the browser during the run.
To illustrate what I would like to happen, consider this:
#!/bin/sh
echo "Content-type: text/plain"
echo
for i in A B C D E
do
echo $i
sleep 10
done
When I do a GET on this script via telnet or with wget, the output comes one row at a time, with ten second intervals ("A"... "B"... "C"... and so on).
When I try to open it in a common browser, the browser seems to buffer it all and present the output when the script is done (50 seconds of silence... "ABCDE").
Is it possible to make the browser present the data to the user as soon as it has arrived?