- output = StringIO.new
- def output.close
- # Zlib does a close. Bad Zlib...
- rewind
- end
- gz = Zlib::GzipWriter.new(output)
- gz.write(response.body)
- gz.close
- if output.length < response.body.length
- @old_response_body = response.body
- response.body = output.string
- response.headers['Content-encoding'] = @compression_encoding
- end
- end
-
- def accepts_gzip?
- return false unless GZIP_SUPPORTED
- accepts = request.env['HTTP_ACCEPT_ENCODING']
- return false unless accepts && accepts =~ /(x-gzip|gzip)/
- @compression_encoding = $1
- true
+ output = StringIO.new
+ def output.close
+ # Zlib does a close. Bad Zlib...
+ rewind
+ end
+ gz = Zlib::GzipWriter.new(output)
+ gz.write(response.body)
+ gz.close
+ if output.length < response.body.length
+ @old_response_body = response.body
+ response.body = output.string
+ response.headers['Content-encoding'] = @compression_encoding
+ end
+ end
+
+ def accepts_gzip?
+ return false unless GZIP_SUPPORTED
+ accepts = request.env['HTTP_ACCEPT_ENCODING']
+ return false unless accepts && accepts =~ /(x-gzip|gzip)/
+ @compression_encoding = $1
+ true