about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/mongrel.rb5
-rw-r--r--lib/mongrel/handlers.rb7
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/mongrel.rb b/lib/mongrel.rb
index e013e5c..28c0dc4 100644
--- a/lib/mongrel.rb
+++ b/lib/mongrel.rb
@@ -264,7 +264,6 @@ module Mongrel
 
       return params
     end
-
   end
 
 
@@ -286,7 +285,6 @@ module Mongrel
     def[]=(key,value)
       @out.write(Const::HEADER_FORMAT % [key, value])
     end
-
   end
 
   # Writes and controls your response to the client using the HTTP/1.1 specification.
@@ -606,7 +604,6 @@ module Mongrel
               sleep @timeout/100 if @timeout > 0
             end
           rescue StopServer
-            STDERR.puts "Server stopped.  Exiting."
             @socket.close if not @socket.closed?
             break
           rescue Errno::EMFILE
@@ -909,7 +906,6 @@ module Mongrel
     # to prevent Ruby from exiting until each one is done.
     def run
       @listeners.each {|name,s|
-        log "Running #{name} listener."
         s.run
       }
 
@@ -922,7 +918,6 @@ module Mongrel
     # should be unlinked on exit.
     def stop(needs_restart=false, unlink_pid_file=true)
       @listeners.each {|name,s|
-        log "Stopping #{name} listener."
         s.stop
       }
 
diff --git a/lib/mongrel/handlers.rb b/lib/mongrel/handlers.rb
index b70568c..99aaeae 100644
--- a/lib/mongrel/handlers.rb
+++ b/lib/mongrel/handlers.rb
@@ -1,4 +1,5 @@
 require 'mongrel/stats'
+require 'zlib'
 
 # Mongrel Web Server - A Mostly Ruby Webserver and Library
 #
@@ -273,17 +274,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.
+  #
+  # Valid option is :always_deflate => false which tells the handler to
+  # deflate everything even if the client can't handle it.
   class DeflateFilter < HttpHandler
     HTTP_ACCEPT_ENCODING = "HTTP_ACCEPT_ENCODING"
 
     def initialize(ops={})
       @options = ops
+      @always_deflate = ops[:always_deflate] || false
     end
 
     def process(request, response)
       accepts = request.params[HTTP_ACCEPT_ENCODING]
       # only process if they support compression
-      if accepts and (accepts.include? "deflate" and not response.body_sent)
+      if @always_deflate or (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