aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/vendor/rack-1.0/rack/content_length.rb
diff options
context:
space:
mode:
authorRuss Smith <russ@bashme.org>2009-03-11 12:50:24 -0500
committerJoshua Peek <josh@joshpeek.com>2009-03-11 12:50:24 -0500
commitf2c7508befb085ffe19ec7fb9ca2e6919cc919c9 (patch)
tree838b029ea24d6d9320082a5b0045d915c10ba1a6 /actionpack/lib/action_controller/vendor/rack-1.0/rack/content_length.rb
parent106976df0911e423042ec4abc165fd561766a047 (diff)
downloadrails-f2c7508befb085ffe19ec7fb9ca2e6919cc919c9.tar.gz
rails-f2c7508befb085ffe19ec7fb9ca2e6919cc919c9.tar.bz2
rails-f2c7508befb085ffe19ec7fb9ca2e6919cc919c9.zip
Update bundled Rack to fix Litespeed compatibility [#2198 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'actionpack/lib/action_controller/vendor/rack-1.0/rack/content_length.rb')
-rw-r--r--actionpack/lib/action_controller/vendor/rack-1.0/rack/content_length.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/actionpack/lib/action_controller/vendor/rack-1.0/rack/content_length.rb b/actionpack/lib/action_controller/vendor/rack-1.0/rack/content_length.rb
index bce22a32c5..1e56d43853 100644
--- a/actionpack/lib/action_controller/vendor/rack-1.0/rack/content_length.rb
+++ b/actionpack/lib/action_controller/vendor/rack-1.0/rack/content_length.rb
@@ -3,21 +3,23 @@ require 'rack/utils'
module Rack
# Sets the Content-Length header on responses with fixed-length bodies.
class ContentLength
+ include Rack::Utils
+
def initialize(app)
@app = app
end
def call(env)
status, headers, body = @app.call(env)
- headers = Utils::HeaderHash.new(headers)
+ headers = HeaderHash.new(headers)
- if !Utils::STATUS_WITH_NO_ENTITY_BODY.include?(status) &&
+ if !STATUS_WITH_NO_ENTITY_BODY.include?(status) &&
!headers['Content-Length'] &&
!headers['Transfer-Encoding'] &&
(body.respond_to?(:to_ary) || body.respond_to?(:to_str))
body = [body] if body.respond_to?(:to_str) # rack 0.4 compat
- length = body.to_ary.inject(0) { |len, part| len + part.length }
+ length = body.to_ary.inject(0) { |len, part| len + bytesize(part) }
headers['Content-Length'] = length.to_s
end