From ecb1d5afce4724760f3f8309f07740bc83ad56b4 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 12 Dec 2004 11:34:22 +0000 Subject: Fixed CgiRequest#out to fall back to #write if doesn't have #syswrite [bitsweat] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@115 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/base.rb | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'actionpack/lib/action_controller') diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index e0c3fb01bf..a7271e9c91 100755 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -441,11 +441,17 @@ module ActionController #:nodoc: logger.info "Streaming file #{path}" unless logger.nil? len = options[:buffer_size] || 4096 File.open(path, 'rb') do |file| - begin - while true - $stdout.syswrite file.sysread(len) + if $stdout.respond_to?(:syswrite) + begin + while true + $stdout.syswrite file.sysread(len) + end + rescue EOFError + end + else + while buf = file.read(len) + $stdout.write buf end - rescue EOFError end end end -- cgit v1.2.3