aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/base/streaming.rb
diff options
context:
space:
mode:
authorSava Chankov <sava@tutuf.com>2009-08-01 19:38:05 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2009-08-01 20:25:59 -0700
commitec94c2550dae463e646a18316bfcdaded9d140c9 (patch)
tree2c4dec32f672ab83a5e88587c5757f6110da9ad8 /actionpack/lib/action_controller/base/streaming.rb
parenta606727606cc0725a39748dd9d310b2b064e3ca7 (diff)
downloadrails-ec94c2550dae463e646a18316bfcdaded9d140c9.tar.gz
rails-ec94c2550dae463e646a18316bfcdaded9d140c9.tar.bz2
rails-ec94c2550dae463e646a18316bfcdaded9d140c9.zip
Ruby 1.9: fix Content-Length for multibyte send_data streaming
[#2661 state:resolved] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'actionpack/lib/action_controller/base/streaming.rb')
-rw-r--r--actionpack/lib/action_controller/base/streaming.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/base/streaming.rb b/actionpack/lib/action_controller/base/streaming.rb
index 9ff4f25f43..f52810ff3a 100644
--- a/actionpack/lib/action_controller/base/streaming.rb
+++ b/actionpack/lib/action_controller/base/streaming.rb
@@ -1,3 +1,5 @@
+require 'active_support/core_ext/string/bytesize'
+
module ActionController #:nodoc:
# Methods for sending arbitrary data and for streaming files to the browser,
# instead of rendering.
@@ -142,7 +144,7 @@ module ActionController #:nodoc:
# instead. See ActionController::Base#render for more information.
def send_data(data, options = {}) #:doc:
logger.info "Sending data #{options[:filename]}" if logger
- send_file_headers! options.merge(:length => data.size)
+ send_file_headers! options.merge(:length => data.bytesize)
@performed_render = false
render :status => options[:status], :text => data
end