in reply to Re: how to implement
in thread how to implement "tail -f" using CGI

That doesn't seem to quite work. I wrote the follow test:
#!/usr/bin/perl $|=1; print "Content-type: text/html\n\n"; for (1..20) { print "$_<br>\n"; sleep 2; }
and the browser still waits until all 20 numbers are outputted before returning the page.

This is under IE 5.0, Perl 5.005 and Apache 1.3.19.

Update: If I increase the range to something higher, I find that around 40 or so, it's starts to output. Apache itself must be doing some buffering ...

Replies are listed 'Best First'.
Buffering in IE and Netscape
by bjelli (Pilgrim) on May 17, 2001 at 12:40 UTC

    The guilty party here is IE, not apache. I just compared IE6 to N4.76, both on win2000. IE won't display anything before it has read about 230 bytes. If you then reload the page, there's no buffering.

    quick fix:

    print "<!-- hey IE, display this page already -->\n" x 5;
    --
    Brigitte    'I never met a chocolate I didnt like'    Jellinek
    http://www.horus.com/~bjelli/         http://perlwelt.horus.at
Re: Re: Re: how to implement
by Hero Zzyzzx (Curate) on May 17, 2001 at 04:39 UTC

    Sorry for being *nix-centric. I only have done perl coding on linux/unix. I don't know how unbuffering behaves on a windows machine. This works perfectly on my linux boxes. Sorry!

      Who said I was doing this on Windows? Ah! The "IE 5.0". Well, my browser is running on Win2k, but everything else is under Linux.

      Btw, it seems that Apache (at least my copy) buffers in 512 byte blocks; regardless of what the CGI itself is doing.

        If your Apache is older than version 1.3, the nph- solution mentioned below may help. After that, it's supposed to have removed any Apache-specific buffering.