aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/vendor/rack-1.0/rack/deflater.rb
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-02-07 16:18:09 -0600
committerJoshua Peek <josh@joshpeek.com>2009-02-07 16:18:09 -0600
commit524d8edf68ab94315a128cbd7570d1cf4faf7d7a (patch)
tree9216f1a68194be1bc27a9e83de40205e1c419f4e /actionpack/lib/action_controller/vendor/rack-1.0/rack/deflater.rb
parent0edb0a4facdf6de8d12a004b59232e1006b93cd9 (diff)
downloadrails-524d8edf68ab94315a128cbd7570d1cf4faf7d7a.tar.gz
rails-524d8edf68ab94315a128cbd7570d1cf4faf7d7a.tar.bz2
rails-524d8edf68ab94315a128cbd7570d1cf4faf7d7a.zip
Update bundled Rack for Ruby 1.9 spec changes
Diffstat (limited to 'actionpack/lib/action_controller/vendor/rack-1.0/rack/deflater.rb')
-rw-r--r--actionpack/lib/action_controller/vendor/rack-1.0/rack/deflater.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/actionpack/lib/action_controller/vendor/rack-1.0/rack/deflater.rb b/actionpack/lib/action_controller/vendor/rack-1.0/rack/deflater.rb
index 32f9a7ec29..3e66680092 100644
--- a/actionpack/lib/action_controller/vendor/rack-1.0/rack/deflater.rb
+++ b/actionpack/lib/action_controller/vendor/rack-1.0/rack/deflater.rb
@@ -36,17 +36,19 @@ module Rack
mtime = headers.key?("Last-Modified") ?
Time.httpdate(headers["Last-Modified"]) : Time.now
body = self.class.gzip(body, mtime)
- headers = headers.merge("Content-Encoding" => "gzip", "Content-Length" => body.length.to_s)
+ size = body.respond_to?(:bytesize) ? body.bytesize : body.size
+ headers = headers.merge("Content-Encoding" => "gzip", "Content-Length" => size.to_s)
[status, headers, [body]]
when "deflate"
body = self.class.deflate(body)
- headers = headers.merge("Content-Encoding" => "deflate", "Content-Length" => body.length.to_s)
+ size = body.respond_to?(:bytesize) ? body.bytesize : body.size
+ headers = headers.merge("Content-Encoding" => "deflate", "Content-Length" => size.to_s)
[status, headers, [body]]
when "identity"
[status, headers, body]
when nil
- message = ["An acceptable encoding for the requested resource #{request.fullpath} could not be found."]
- [406, {"Content-Type" => "text/plain", "Content-Length" => message[0].length.to_s}, message]
+ message = "An acceptable encoding for the requested resource #{request.fullpath} could not be found."
+ [406, {"Content-Type" => "text/plain", "Content-Length" => message.length.to_s}, [message]]
end
end