Created
June 15, 2012 14:48
-
-
Save zporter/2936818 to your computer and use it in GitHub Desktop.
Fixes deadlock issue on Rack::Deflater
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rack/deflater' | |
module Rack | |
class Deflater | |
class GzipStream | |
def each(&block) | |
@writer = block | |
gzip =::Zlib::GzipWriter.new(self) | |
gzip.mtime = @mtime | |
@body.each { |part| | |
gzip.write(part) | |
gzip.flush | |
} | |
ensure | |
@body.close if @body.respond_to?(:close) | |
gzip.close if gzip && !gzip.closed? | |
@writer = nil | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Where does this go in my app?