lib/async/http/body/inflate.rb in async-http-0.35.1 vs lib/async/http/body/inflate.rb in async-http-0.36.0
- old
+ new
@@ -34,10 +34,11 @@
return if @stream.closed?
if chunk = super
@input_length += chunk.bytesize
+ # It's possible this triggers the stream to finish.
chunk = @stream.inflate(chunk)
@output_length += chunk.bytesize
else
chunk = @stream.finish
@@ -45,10 +46,14 @@
@output_length += chunk.bytesize
@stream.close
end
- return chunk.empty? ? nil : chunk
+ if @stream.finished? and chunk.empty?
+ return nil
+ end
+
+ return chunk
end
end
end
end
end
\ No newline at end of file