my $subr = $r->lookup_file($file); return 404 unless -f $file and $subr->status == 200; $r->content_type("application/download"); $r->header_out('Content-disposition' => "attachment; filename=\"$file\""); $r->send_http_header; return 200 if $r->header_only; $subr->run; $m->abort;