diff options
Diffstat (limited to 'lib/rack/deflater.rb')
-rw-r--r-- | lib/rack/deflater.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/rack/deflater.rb b/lib/rack/deflater.rb index ad0f5316..e7da3a3a 100644 --- a/lib/rack/deflater.rb +++ b/lib/rack/deflater.rb @@ -60,7 +60,10 @@ module Rack @writer = block gzip =::Zlib::GzipWriter.new(self) gzip.mtime = @mtime - @body.each { |part| gzip.write(part) } + @body.each { |part| + gzip.write(part) + gzip.flush + } @body.close if @body.respond_to?(:close) gzip.close @writer = nil @@ -86,7 +89,7 @@ module Rack def each deflater = ::Zlib::Deflate.new(*DEFLATE_ARGS) - @body.each { |part| yield deflater.deflate(part) } + @body.each { |part| yield deflater.deflate(part, Zlib::SYNC_FLUSH) } @body.close if @body.respond_to?(:close) yield deflater.finish nil |