about summary refs log tree commit homepage
path: root/lib/mongrel/handlers.rb
diff options
context:
space:
mode:
authorzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-05-23 06:40:24 +0000
committerzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-05-23 06:40:24 +0000
commite6e7c3a058e38db93330c68ebea9564c753075b6 (patch)
treec1b34fb6c7da42aab988f2ccea222e45dae2f515 /lib/mongrel/handlers.rb
parent2499218abf60d1afcf203cf81633e3b61eaa4688 (diff)
downloadunicorn-e6e7c3a058e38db93330c68ebea9564c753075b6.tar.gz
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@208 19e92222-5c0b-0410-8929-a290d50e31e9
Diffstat (limited to 'lib/mongrel/handlers.rb')
-rw-r--r--lib/mongrel/handlers.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/mongrel/handlers.rb b/lib/mongrel/handlers.rb
index 1134bdf..0e34a15 100644
--- a/lib/mongrel/handlers.rb
+++ b/lib/mongrel/handlers.rb
@@ -269,21 +269,21 @@ module Mongrel
   # When added to a config script (-S in mongrel_rails) it will
   # look at the client's allowed response types and then gzip
   # compress anything that is going out.
-  class DeflateCompressFilter < HttpHandler
+  class DeflateFilter < HttpHandler
     HTTP_ACCEPT_ENCODING = "HTTP_ACCEPT_ENCODING"
 
-    def initialize(ops)
+    def initialize(ops={})
       @options = ops
     end
 
     def process(request, response)
       accepts = request.params[HTTP_ACCEPT_ENCODING]
       # only process if they support compression
-      if accepts.include? "gzip" or accepts.include? "deflate" and not response.body_sent
-        head["Content-Encoding"] = "deflate"
+      if accepts and (accepts.include? "deflate" and not response.body_sent)
+        response.header["Content-Encoding"] = "deflate"
         # we can't just rewind the body and gzip it since the body could be an attached file
         response.body.rewind
-        gzout << Zlib::Deflate.deflate(response.body.read)
+        gzout = StringIO.new(Zlib::Deflate.deflate(response.body.read))
         gzout.rewind
         response.body.close
         response.body = gzout