I bet you're forgetting to discard anything already in Mason's output buffer before sending the binary.
I'll bet you're spot on. I changed my test file from a pdf to an excel spreadsheet. When it tries to open it tells me there are missing files, all of which are .css pages loaded by the autohandler.
I used the $m->clear_buffer method, and Excel no longer complains about missing files, but the content of the spreadsheet is the content from the autohandler that occurs after the $m->call_next() call. Is there anyway around that?
There is no 'content' in the called component, and this is the (current) entirety of the <%init> block.
<%init>
$filename = 'fairtax.xls';
use Apache2::SubRequest;
my $file = '/var/www/eddie/fairtax.xls';
my $subr = $r->lookup_file($file);
return 404 unless -f $file and $subr->status == 200;
$m->clear_buffer;
$r->err_headers_out->add('Content-disposition' => ("attachment; filena
+me=$filename"));
$r->content_type($subr->content_type);
$r->send_http_header;
return 200 if $r->header_only;
$subr->run;
$m->abort;
</%init>
|