class Aws::Plugins::ChecksumAlgorithm::AwsChunkedTrailerDigestIO
def read(length, buf)
def read(length, buf) # account for possible leftover bytes at the end, if we have trailer bytes, send them if @trailer_io return @trailer_io.read(length, buf) end chunk = @io.read(length) if chunk @digest.update(chunk) application_chunked = "#{chunk.bytesize.to_s(16)}\r\n#{chunk}\r\n" return StringIO.new(application_chunked).read(application_chunked.size, buf) else trailers = {} trailers[@location_name] = @digest.base64digest trailers = trailers.map { |k,v| "#{k}:#{v}"}.join("\r\n") @trailer_io = StringIO.new("0\r\n#{trailers}\r\n\r\n") chunk = @trailer_io.read(length, buf) end chunk end