提交 ecb1d5af 编写于 作者: D David Heinemeier Hansson

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
上级 0990c130
*SVN* *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] * 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: * Added link_to_image(src, options = {}, html_options = {}, *parameters_for_method_reference). Documentation:
......
...@@ -441,11 +441,17 @@ def send_file(path, options = {}) ...@@ -441,11 +441,17 @@ def send_file(path, options = {})
logger.info "Streaming file #{path}" unless logger.nil? logger.info "Streaming file #{path}" unless logger.nil?
len = options[:buffer_size] || 4096 len = options[:buffer_size] || 4096
File.open(path, 'rb') do |file| File.open(path, 'rb') do |file|
begin if $stdout.respond_to?(:syswrite)
while true begin
$stdout.syswrite file.sysread(len) while true
$stdout.syswrite file.sysread(len)
end
rescue EOFError
end
else
while buf = file.read(len)
$stdout.write buf
end end
rescue EOFError
end end
end end
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册