> On 07 Feb 2017, at 02:40, André Warnier (tomcat) <a...@ice-sa.com> wrote:
> 
> On 06.02.2017 18:33, Ben RUBSON wrote:
>> Hi,
>> 
>> I'm using mod_perl2 and I'm trying to flush headers before the body content.
>> 
>> $r->content_type('application/zip');
>> $r->headers_out->add('Content-Disposition' => 'attachment');
>> $r->rflush;
>> long_operation();
>> 
>> Unfortunately this does not work.
> 
> When you say "this does not work", can you be more explicit ?

Yes,

> If you trace the browser request/response headers, what does it show exactly ?

the headers on client side do not arrive until there is also some body content.
So in the quoted code below, due to the little body addition (\0), headers 
correctly immediately arrive on client side.

>> The following works, but of course corrupts my output :
>> 
>> $r->content_type('application/zip');
>> $r->headers_out->add('Content-Disposition' => 'attachment');
>> print "\0";
>> $r->rflush;
>> long_operation();

In the documentation :
https://perl.apache.org/docs/2.0/user/coding/coding.html#Forcing_HTTP_Response_Headers_Out
"Apache 2.0 doesn't provide a method to force HTTP response headers sending 
(what used to be done by send_http_header() in Apache 1.3).
HTTP response headers are sent as soon as the first bits of the response body 
are seen by the special core output filter that generates these headers."

What is strange is that just below this extract is given the rflush example I'm 
trying to use.

Ben

Reply via email to