+ failreason = HASHSUM_MISMATCH;
+
+ if(ErrorText.empty())
+ {
+ if (Status == StatAuthError)
+ {
+ std::ostringstream out;
+ switch (failreason)
+ {
+ case HASHSUM_MISMATCH:
+ out << _("Hash Sum mismatch") << std::endl;
+ break;
+ case MAXIMUM_SIZE_EXCEEDED:
+ case OTHER:
+ out << LookupTag(Message, "Message") << std::endl;
+ break;
+ }
+ auto const ExpectedHashes = GetExpectedHashes();
+ if (ExpectedHashes.empty() == false)
+ {
+ out << "Hashes of expected file:" << std::endl;
+ for (auto const &hs: ExpectedHashes)
+ out << " - " << hs.toStr() << std::endl;
+ }
+ if (failreason == HASHSUM_MISMATCH)
+ {
+ out << "Hashes of received file:" << std::endl;
+ for (char const * const * type = HashString::SupportedHashes(); *type != NULL; ++type)
+ {
+ std::string const tagname = std::string(*type) + "-Hash";
+ std::string const hashsum = LookupTag(Message, tagname.c_str());
+ if (hashsum.empty() == false)
+ out << " - " << HashString(*type, hashsum).toStr() << std::endl;
+ }
+ out << "Last modification reported: " << LookupTag(Message, "Last-Modified", "<none>") << std::endl;
+ }
+ ErrorText = out.str();
+ }
+ else
+ ErrorText = LookupTag(Message,"Message");
+ }
+
+ switch (failreason)
+ {
+ case MAXIMUM_SIZE_EXCEEDED: RenameOnError(MaximumSizeExceeded); break;
+ case HASHSUM_MISMATCH: RenameOnError(HashSumMismatch); break;
+ case OTHER: break;
+ }