lib/protocol/http/body/rewindable.rb in protocol-http-0.16.3 vs lib/protocol/http/body/rewindable.rb in protocol-http-0.17.0
- old
+ new
@@ -31,22 +31,12 @@
def initialize(body)
super(body)
@chunks = []
@index = 0
- @digest = nil
end
- def digest
- if @digest.nil?
- @digest = Digest::SHA256.new
- @chunks.each{|chunk| @digest.update(chunk)}
- end
-
- @digest.hexdigest
- end
-
def empty?
(@index >= @chunks.size) && super
end
# A rewindable body wraps some other body. Convert it to a buffered body
@@ -59,10 +49,9 @@
chunk = @chunks[@index]
@index += 1
else
if chunk = super
@chunks << chunk
- @digest&.update(chunk)
@index += 1
end
end
# We dup them on the way out, so that if someone modifies the string, it won't modify the rewindability.