Flushing output and preserving headers
am 03.01.2009 16:24:05 von Kate YoakHey guys,
I seem to have some magic going on in the background and it has
stopped me in my tracks.
The actual problem is that my Content-type header gets overwritten
before it is sent back to the client. In addition, I am unable to
flush the output.
Here is the idea:
$r->headers_out->set('Content-Type' => "image/gif");
warn $r->headers_out->get('Content-Type');
#warns image/gif
for my $i (0..5){
sleep(1);
$r->print($i);
$r->rflush; #does not send $i to client. The headers do arrive at the
first iteration (with the wrong content-type).
warn $r->headers_out->get('Content-Type');
#warns text/plain
}
#sends 012345, all at once
Server version: Apache/2.2.8 (Unix)
mod_perl-2.0.2-6.3.el5
Server: Apache/2.2.8 (Unix) DAV/2 mod_apreq2-20051231/2.6.0 mod_perl/
2.0.4 Perl/v5.8.8
Where is the magic?
Cheers,
Kate