Re: [webmin-devel] Writing CGI Output Immediately without buffer

"Jamie Cameron" <[email protected]>
Newsgroups gmane.comp.web.webmin.devel
Message-ID <[email protected]>
On 3/Apr/2005 05:39 Tan Rezaei wrote ..
> 
> Hi all,
> I am sure this question has been asked many times but I can't seem to find
> the answer anywhere.
> I am trying to write the output of my cgi as it happens. I have a loop
> that 
> runs a certain UNIX command about 1000 times and each time prints the 
> output. Well It doesn't actually show me any of the output until its done
> so 
> the users have to wait and wait .. Sometimes the refresh the screen and
> we 
> all know what that will do.
> How does webmin handle this ? I am trying to duplicate the feel of the
> module download page or the fsdump module but can't seem to figure out
> what 
> that code is really doing.

The best way to force output to be sent immediately to the browser is for
your CGI to call the ui_print_unbuffered_header function instead of ui_print_header.
Or if you are not using those ui-lib.pl functions, you can use code like :

$| = 1;
$theme_no_table = 1;
&header("page header", "");

 - Jamie


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
-
Forwarded by the Webmin development list at [email protected]
To remove yourself from this list, go to
http://lists.sourceforge.net/lists/listinfo/webadmin-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.