class Aws::Plugins::GlacierChecksums::Handler

def compute_checksums(body, &block)

here so the sigv4 signer does not need to re-read the body.
checksum is required by signature version 4. We compute both
by Glacier for operations where you upload a file. The other
Computes two checksums of the body. The tree hash is required
def compute_checksums(body, &block)
  tree_hash = TreeHash.new
  digest = OpenSSL::Digest.new('sha256')
  # if the body is empty/EOF, then we should compute the
  # digests of the empty string
  if body.size == 0
    tree_hash.update('')
    digest.update('')
  end
  until body.eof?
    chunk = body.read(1024 * 1024) # read 1MB
    tree_hash.update(chunk)
    digest.update(chunk)
  end
  body.rewind
  yield(digest.to_s, tree_hash)
end