# File lib/mongrel/handlers.rb, line 292 292: def process(request, response) 293: accepts = request.params[HTTP_ACCEPT_ENCODING] 294: # only process if they support compression 295: if @always_deflate or (accepts and (accepts.include? "deflate" and not response.body_sent)) 296: response.header["Content-Encoding"] = "deflate" 297: # we can't just rewind the body and gzip it since the body could be an attached file 298: response.body.rewind 299: gzout = StringIO.new(Zlib::Deflate.deflate(response.body.read)) 300: gzout.rewind 301: response.body.close 302: response.body = gzout 303: end 304: end