Description:
added option for Apapche X-Sendfile
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@370 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r172:400ab663b3b9 - - 2 files changed: 13 inserted, 9 deleted
@@ -20,15 +20,15 | |||
|
20 | 20 | redirect_to :action => 'index' and return |
|
21 | 21 | end |
|
22 | 22 | |
|
23 | - response.headers['Content-Type'] = "application/force-download" | |
|
24 | - response.headers['Content-Disposition'] = "attachment; filename=\"#{File.basename(filename)}\"" | |
|
25 | - response.headers["X-Sendfile"] = filename | |
|
26 |
- response.headers[ |
|
|
27 | - render :nothing => true | |
|
28 | - | |
|
29 | - return | |
|
30 | - | |
|
31 | - send_file filename, :stream => false, :filename => base_filename | |
|
23 | + if defined?(USE_APACHE_XSENDFILE) and USE_APACHE_XSENDFILE | |
|
24 | + response.headers['Content-Type'] = "application/force-download" | |
|
25 | + response.headers['Content-Disposition'] = "attachment; filename=\"#{File.basename(filename)}\"" | |
|
26 | + response.headers["X-Sendfile"] = filename | |
|
27 | + response.headers['Content-length'] = File.size(filename) | |
|
28 | + render :nothing => true | |
|
29 | + else | |
|
30 | + send_file filename, :stream => false, :filename => base_filename | |
|
31 | + end | |
|
32 | 32 | end |
|
33 | 33 | |
|
34 | 34 | protected |
You need to be logged in to leave comments.
Login now