Re: file targets
Daniel Bretoi <[email protected]>
| Newsgroups | gmane.comp.apache.mod-ruby |
|---|---|
| Message-ID | <[email protected]> |
> I'm not sure how to do it in mod_ruby. I suppose you have to look at the
> Apache.request object. See http://rubydoc.org/books/modruby/c434.htm . In case
> it does help in anything, in Perl (mod_perl) is something like:
>
> $r->header_out("Content-Disposition", "attachment; filename=$myfilename");
> $r->content_type($mime)
>
> I suppose in mod_ruby is
>
> Apache.request.header_out("Content-Disposition", "blah")
ok, just for the record, I tried several variations of this:
r = Apache.request_
file = "/somefile"
File.open(file) { |f|
r.content_type = "application/octet-stream"
p
r.headers_out.add("Content-Disposition:attachment","filename=blah");
r.send_http_header
exit(Apache::OK) if r.header_only?
r.send_fd(f)
}
the various being with r.headers_out.add