mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Excise the headache-prone syswrite in send_file.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4403 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
6aaa08d85b
commit
ace2a66f0c
1 changed files with 3 additions and 12 deletions
|
@ -69,17 +69,8 @@ module ActionController #:nodoc:
|
|||
logger.info "Streaming file #{path}" unless logger.nil?
|
||||
len = options[:buffer_size] || 4096
|
||||
File.open(path, 'rb') do |file|
|
||||
if output.respond_to?(:syswrite)
|
||||
begin
|
||||
while true
|
||||
output.syswrite(file.sysread(len))
|
||||
end
|
||||
rescue EOFError
|
||||
end
|
||||
else
|
||||
while buf = file.read(len)
|
||||
output.write(buf)
|
||||
end
|
||||
while buf = file.read(len)
|
||||
output.write(buf)
|
||||
end
|
||||
end
|
||||
}
|
||||
|
@ -125,7 +116,7 @@ module ActionController #:nodoc:
|
|||
end
|
||||
|
||||
disposition = options[:disposition].dup || 'attachment'
|
||||
|
||||
|
||||
disposition <<= %(; filename="#{options[:filename]}") if options[:filename]
|
||||
|
||||
@headers.update(
|
||||
|
|
Loading…
Reference in a new issue