class Bundler::CompactIndexClient::Updater

def append(remote_path, local_path, etag_path)

def append(remote_path, local_path, etag_path)
  return false unless local_path.file? && local_path.size.nonzero?
  CacheFile.copy(local_path) do |file|
    etag = etag_path.read.tap(&:chomp!) if etag_path.file?
    # Subtract a byte to ensure the range won't be empty.
    # Avoids 416 (Range Not Satisfiable) responses.
    response = @fetcher.call(remote_path, request_headers(etag, file.size - 1))
    break true if response.is_a?(Gem::Net::HTTPNotModified)
    file.digests = parse_digests(response)
    # server may ignore Range and return the full response
    if response.is_a?(Gem::Net::HTTPPartialContent)
      tail = response.body.byteslice(1..-1)
      break false unless tail && file.append(tail)
    else
      file.write(response.body)
    end
    CacheFile.write(etag_path, etag_from_response(response))
    true
  end
end