1
0
Fork 0
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:
Jeremy Kemper 2006-06-02 03:34:38 +00:00
parent 6aaa08d85b
commit ace2a66f0c

View file

@ -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(