diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-12 11:34:22 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-12 11:34:22 +0000 |
commit | ecb1d5afce4724760f3f8309f07740bc83ad56b4 (patch) | |
tree | e4c58d8d40823a1571a39c62855498e3c36c1827 | |
parent | 0990c1309dfa1751c1e1a48b48bfcb994ab68db0 (diff) | |
download | rails-ecb1d5afce4724760f3f8309f07740bc83ad56b4.tar.gz rails-ecb1d5afce4724760f3f8309f07740bc83ad56b4.tar.bz2 rails-ecb1d5afce4724760f3f8309f07740bc83ad56b4.zip |
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
-rw-r--r-- | actionpack/CHANGELOG | 2 | ||||
-rwxr-xr-x | actionpack/lib/action_controller/base.rb | 14 |
2 files changed, 12 insertions, 4 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 89c834dd47..d31e2f15fe 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Fixed CgiRequest#out to fall back to #write if $stdout doesn't have #syswrite [bitsweat] + * Fixed all helpers so that they use XHTML compliant double quotes for values instead of single quotes [htonl/bitsweat] * Added link_to_image(src, options = {}, html_options = {}, *parameters_for_method_reference). Documentation: 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 |