diff options
author | raggi <jftucker@gmail.com> | 2010-10-04 13:00:25 -0300 |
---|---|---|
committer | raggi <jftucker@gmail.com> | 2010-10-04 21:50:32 -0300 |
commit | 50cdd0bf000a9ffb3eb3760fda2ff3e1ad18f3a7 (patch) | |
tree | 15534d460555fa699e91fe3ddc2a87bcc79dad9b /lib/rack/content_length.rb | |
parent | f76e1bae9eac1cbb1e7b0b2846e6a0f8e42f9256 (diff) | |
download | rack-50cdd0bf000a9ffb3eb3760fda2ff3e1ad18f3a7.tar.gz |
release semantics of Rack::Chunked and Rack::ContentLength from handlers. this should not be forced on users.
Diffstat (limited to 'lib/rack/content_length.rb')
-rw-r--r-- | lib/rack/content_length.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/rack/content_length.rb b/lib/rack/content_length.rb index ba72ef2c..32f31142 100644 --- a/lib/rack/content_length.rb +++ b/lib/rack/content_length.rb @@ -16,10 +16,10 @@ module Rack if !STATUS_WITH_NO_ENTITY_BODY.include?(status.to_i) && !headers['Content-Length'] && !headers['Transfer-Encoding'] && - (body.respond_to?(:to_ary) || body.respond_to?(:to_str)) + body.respond_to?(:to_ary) - body = [body] if body.respond_to?(:to_str) # rack 0.4 compat - length = body.to_ary.inject(0) { |len, part| len + bytesize(part) } + length = 0 + body.each { |part| length += bytesize(part) } headers['Content-Length'] = length.to_s end |