# File lib/mongrel/handlers.rb, line 292 def process(request, response) accepts = request.params[HTTP_ACCEPT_ENCODING] # only process if they support compression 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 gzout = StringIO.new(Zlib::Deflate.deflate(response.body.read)) gzout.rewind response.body.close response.body = gzout end end