aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-06-02 03:34:38 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-06-02 03:34:38 +0000
commitace2a66f0cdda4b752b6226eadf07873c402e380 (patch)
treea639bd2f4aa5e89d4a3e1edcc66aa44beb408f40
parent6aaa08d85b4acb89c44e951398e9f6a5e3e0daec (diff)
downloadrails-ace2a66f0cdda4b752b6226eadf07873c402e380.tar.gz
rails-ace2a66f0cdda4b752b6226eadf07873c402e380.tar.bz2
rails-ace2a66f0cdda4b752b6226eadf07873c402e380.zip
Excise the headache-prone syswrite in send_file.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4403 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--actionpack/lib/action_controller/streaming.rb15
1 files changed, 3 insertions, 12 deletions
diff --git a/actionpack/lib/action_controller/streaming.rb b/actionpack/lib/action_controller/streaming.rb
index 618888d096..dfc9cdc274 100644
--- a/actionpack/lib/action_controller/streaming.rb
+++ b/actionpack/lib/action_controller/streaming.rb
@@ -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(