Flushing output and preserving headers

Flushing output and preserving headers

am 03.01.2009 16:24:05 von Kate Yoak

Hey 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

Re: Flushing output and preserving headers

am 03.01.2009 16:30:44 von torsten.foertsch

On Sat 03 Jan 2009, Kate Yoak wrote:
> $r->headers_out->set('Content-Type' => "image/gif");

use $r->content_type(...)

Torsten

--
Need professional mod_perl support?
Just hire me: torsten.foertsch@gmx.net

RE: Flushing output and preserving headers

am 03.01.2009 17:34:49 von Kate Yoak

That worked! Thanks.

> -----Original Message-----
> From: Torsten Foertsch [mailto:torsten.foertsch@gmx.net]
> Sent: Saturday, January 03, 2009 7:31 AM
> To: modperl@perl.apache.org
> Cc: Kate Yoak
> Subject: Re: Flushing output and preserving headers
>
>
> On Sat 03 Jan 2009, Kate Yoak wrote:
> > $r->headers_out->set('Content-Type' => "image/gif");
>
> use $r->content_type(...)
>
> Torsten
>
> --
> Need professional mod_perl support?
> Just hire me: torsten.foertsch@gmx.net
>