Custom http headers from WebRT template

How can I set a custom HTTP header from a template in RT 2.0.15?

I’ve got a fragment like this at the top of a template:

<%perl>
if ($resultType eq ‘CSV’) {
SetContentType(“text/csv”);
SetHeader(“Content-Disposition” => ‘filename=“rt-priority.csv”’);

 my $out = [stuff to generate some CSV]

 $m->out($out); 
 $m->abort; 

}
</%perl>

Obviously, the SetHeader line doesn’t work because there is no
SetHeader. What should I use there?

-Rich

Rich Lafferty --------------±----------------------------------------------
Ottawa, Ontario, Canada | Save the Pacific Northwest Tree Octopus!
http://www.lafferty.ca/ | Save The Pacific Northwest Tree Octopus
rich@lafferty.ca -----------±----------------------------------------------

How can I set a custom HTTP header from a template in RT 2.0.15?

To quelch the $r->header_out replies – using FastCGI, not mod_perl. :slight_smile:

Thanks,

-Rich

Rich Lafferty --------------±----------------------------------------------
Ottawa, Ontario, Canada | Save the Pacific Northwest Tree Octopus!
http://www.lafferty.ca/ | Save The Pacific Northwest Tree Octopus
rich@lafferty.ca -----------±----------------------------------------------

How can I set a custom HTTP header from a template in RT 2.0.15?

To quelch the $r->header_out replies – using FastCGI, not mod_perl. :slight_smile:

Ew.

SetContentType(qq(text/csv\r\nContent-Disposition: filename=“rt-priority.csv”));

But it works! I haven’t poked at 2.1/3.0 yet, but fastcgi custom
headers would be a worthwhile feature.

Cheers,

-Rich

Rich Lafferty --------------±----------------------------------------------
Ottawa, Ontario, Canada | Save the Pacific Northwest Tree Octopus!
http://www.lafferty.ca/ | Save The Pacific Northwest Tree Octopus
rich@lafferty.ca -----------±----------------------------------------------