comparison OrthancServer/Sources/main.cpp @ 4640:66109d24d26e

"ETag" headers for metadata and attachments now allow strong comparison (MD5 is included)
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 26 Apr 2021 15:22:44 +0200
parents 5fabef29c4ff
children 4beebbb3636e
comparison
equal deleted inserted replaced
4639:c638dd444de0 4640:66109d24d26e
1491 1491
1492 { 1492 {
1493 static const char* const CHECK_REVISIONS = "CheckRevisions"; 1493 static const char* const CHECK_REVISIONS = "CheckRevisions";
1494 1494
1495 OrthancConfiguration::ReaderLock lock; 1495 OrthancConfiguration::ReaderLock lock;
1496
1496 if (lock.GetConfiguration().GetBooleanParameter(CHECK_REVISIONS, false)) 1497 if (lock.GetConfiguration().GetBooleanParameter(CHECK_REVISIONS, false))
1497 { 1498 {
1498 if (database.HasRevisionsSupport()) 1499 if (database.HasRevisionsSupport())
1499 { 1500 {
1500 LOG(INFO) << "Handling of revisions is enabled, and the custom database back-end *has* " 1501 LOG(INFO) << "Handling of revisions is enabled, and the custom database back-end *has* "
1502 } 1503 }
1503 else 1504 else
1504 { 1505 {
1505 LOG(WARNING) << "The custom database back-end has *no* support for revisions of metadata and attachments, " 1506 LOG(WARNING) << "The custom database back-end has *no* support for revisions of metadata and attachments, "
1506 << "but configuration option \"" << CHECK_REVISIONS << "\" is set to \"true\""; 1507 << "but configuration option \"" << CHECK_REVISIONS << "\" is set to \"true\"";
1508 }
1509
1510 static const char* const STORE_MD5 = "StoreMD5ForAttachments";
1511
1512 if (!lock.GetConfiguration().GetBooleanParameter(STORE_MD5, true))
1513 {
1514 throw OrthancException(
1515 ErrorCode_ParameterOutOfRange,
1516 "The revision system is enabled by configuration option \"" + std::string(CHECK_REVISIONS) +
1517 "\", but won't work properly for attachments if \"" + std::string(STORE_MD5) + "\" is set to \"false\"");
1507 } 1518 }
1508 } 1519 }
1509 } 1520 }
1510 1521
1511 bool success = ConfigureServerContext 1522 bool success = ConfigureServerContext