http://qs321.pair.com?node_id=150578


in reply to cgi buffer flush

You were clever to make the filehandle hot. It would have been exactly what I would have done to solve this problem. In fact you should always make STDOUT hot in a CGI program to ensure that the headers get to the browser in order.

However, your problem has to do with two things: Apache behavior and browser behavior. As to the first, I'm no expert at Apache, but I do know that Apache will wait until the program finishes execution before sending anything to the browser - hence the 10 second wait until you see anything. As to the second, you can't be sure when the browser will parse and display the page. It might wait until it gets the whole page, it might parse and display in block - every 8k or so. I don't know. After all the browser doesn't know how tags at the bottom of your page may affect the top. These problems taken to account, it may be obvious that a client side program probably can't solve your problem - you'll need some client side solution - Flash, Curl, or even JavaScript

Good Luck!

Cheers,
Erik