use of org.dcache.util.ChecksumType in project dcache by dCache.
the class RemoteHttpDataTransferProtocol method checkChecksums.
private void checkChecksums(RemoteHttpDataTransferProtocolInfo info, String rfc3230, Optional<Set<Checksum>> knownChecksums) throws ThirdPartyTransferFailedCacheException {
Map<ChecksumType, Checksum> checksums = uniqueIndex(Checksums.decodeRfc3230(rfc3230), Checksum::getType);
boolean verified = false;
if (knownChecksums.isPresent()) {
for (Checksum ourChecksum : knownChecksums.get()) {
ChecksumType type = ourChecksum.getType();
if (checksums.containsKey(type)) {
checkChecksumEqual(ourChecksum, checksums.get(type));
verified = true;
}
}
}
if (info.isVerificationRequired() && !verified) {
throw new ThirdPartyTransferFailedCacheException("no useful checksum in HEAD response: " + (rfc3230 == null ? "(none sent)" : rfc3230));
}
}
Aggregations