0
@@ -12,19 +12,21 @@ module ActionController #:nodoc:
0
X_SENDFILE_HEADER = 'X-Sendfile'.freeze
0
- # Sends the file by streaming it 4096 bytes at a time. This way the
0
- # whole file doesn't need to be read into memory at once. This makes
0
- # it feasible to send even large files.
0
+ # Sends the file, by default streaming it 4096 bytes at a time. This way the
0
+ # whole file doesn't need to be read into memory at once. This makes it
0
+ # feasible to send even large files. You can optionally turn off streaming
0
+ # and send the whole file at once.
0
- # Be careful to sanitize the path parameter if it
coming from a web
0
+ # Be careful to sanitize the path parameter if it
is coming from a web
0
# page. <tt>send_file(params[:path])</tt> allows a malicious user to
0
# download any file on your server.
0
# * <tt>:filename</tt> - suggests a filename for the browser to use.
0
# Defaults to <tt>File.basename(path)</tt>.
0
- # * <tt>:type</tt> - specifies an HTTP content type.
0
- # Defaults to 'application/octet-stream'.
0
+ # * <tt>:type</tt> - specifies an HTTP content type. Defaults to 'application/octet-stream'.
0
+ # * <tt>:length</tt> - used to manually override the length (in bytes) of the content that
0
+ # is going to be sent to the client. Defaults to <tt>File.size(path)</tt>.
0
# * <tt>:disposition</tt> - specifies whether the file will be shown inline or downloaded.
0
# Valid values are 'inline' and 'attachment' (default).
0
# * <tt>:stream</tt> - whether to send the file to the user agent as it is read (+true+)
0
@@ -35,6 +37,12 @@ module ActionController #:nodoc:
0
# * <tt>:url_based_filename</tt> - set to +true+ if you want the browser guess the filename from
0
# the URL, which is necessary for i18n filenames on certain browsers
0
# (setting <tt>:filename</tt> overrides this option).
0
+ # * <tt>:x_sendfile</tt> - uses X-Sendfile to send the file when set to +true+. This is currently
0
+ # only available with Lighttpd/Apache2 and specific modules installed and activated. Since this
0
+ # uses the web server to send the file, this may lower memory consumption on your server and
0
+ # it will not block your application for further requests.
0
+ # See http://blog.lighttpd.net/articles/2006/07/02/x-sendfile and
0
+ # http://tn123.ath.cx/mod_xsendfile/ for details. Defaults to +false+.
0
# The default Content-Type and Content-Disposition headers are
0
# set to download arbitrary binary files in as many browsers as
0
@@ -99,8 +107,7 @@ module ActionController #:nodoc:
0
# * <tt>:filename</tt> - suggests a filename for the browser to use.
0
- # * <tt>:type</tt> - specifies an HTTP content type.
0
- # Defaults to 'application/octet-stream'.
0
+ # * <tt>:type</tt> - specifies an HTTP content type. Defaults to 'application/octet-stream'.
0
# * <tt>:disposition</tt> - specifies whether the file will be shown inline or downloaded.
0
# Valid values are 'inline' and 'attachment' (default).
0
# * <tt>:status</tt> - specifies the status code to send with the response. Defaults to '200 OK'.