smithd77 has asked for the wisdom of the Perl Monks concerning the following question:

I have a page, that adds a filter to a mason generated page. The filter takes the output and converts it to a csv. The csv is sent fine, but none of the headers are being sent. I've been setting the headers by doing the following:
$r->err_headers_out->{'Content-Disposition'} ="attachment; filename=\" +$csv_file\""; $r->headers_out->{'Content-Disposition'} ="attachment; filename=\"$c +sv_file\""; $r->headers_out->{'ABZZ-Disposition'} ="attachment; filename=\"$csv_ +file\""; $r->content_type('text/csv'); $r->set_content_length([stat $csv_fh]->[7]); $r->rflush(); And then send the file via this: $r->sendfile($pdf_file);
My question is what am I doing that headers aren't being sent?

Replies are listed 'Best First'.
Re: Headers not being sent with mod_perl2
by Anonymous Monk on Apr 09, 2014 at 06:30 UTC

    I have a page, that adds a filter.... My question is what am I doing that headers aren't being sent?

    What do you have? The filter/configuration bits are as important as self-contained code , because mason/mod_perl/apache ... too many details that need to be detailed (example of similar journey mod_perl give 404 not_found with content )

      The filter is dynamically added, it's not a config option and is added by :
      my $r = idc::NTI::Session::Request->get_instance->get_apache_request; $r->add_output_filter(\&{"${class}::handler"});
      The filter works perfectly but can not change the headers.

        The filter works perfectly but can not change the headers.

        Ok then, have a nice day :)

Re: Headers not being sent with mod_perl2 (twice)
by tye (Sage) on Apr 10, 2014 at 01:07 UTC

    Does calling content_type() twice cause the second call and/or any headers after the first call to be ignored? (I didn't try to test that and all things Apache are C code and not even that is well contained so I'm much less likely to go searching for the right code to read to try figure out details.)

    - tye