Reputation: 1846
I am aware of the other topic related to this issue, my problem is that the suggested solution didn't work for me. This is the test script I am using:
#!/usr/bin/perl -sW
use CGI::Carp qw( fatalsToBrowser );
use CGI qw/:standard/;
use 5.12.0;
my $q = CGI->new;
$|++;
print $q->header('text/html');
print 0;
sleep(2);
print 1;
sleep(5);
print 2;
exit;
And even with autoflush true, all output gets buffered and output only when the execution of the script is finished. Any ideas why this is happening?
Upvotes: 0
Views: 213
Reputation: 1846
Wow this is stupid, it seems that chrome on linux actually has its own output buffering. I've tested the identical script in firefox and it works... Thanks everyone for the help though!
Upvotes: 1
Reputation: 10637
What happens if you run this from the shell?
This depends on the way the web server handles CGI. Some buffer the whole thing to provide an accurate Content-Length
. In my recent memory, Apache does not buffer (though it may used to).
Configure your web server to use Non-Parsed Headers which will pump data as available.
Upvotes: 2