Try to overcome empty licenseURL item during fulfillment step

This commit is contained in:
Grégory Soutadé 2024-01-02 20:09:55 +01:00
parent 92a67312bd
commit 1a6dfc8b97

View File

@ -454,9 +454,17 @@ namespace gourou
void DRMProcessor::fetchLicenseServiceCertificate(const std::string& licenseURL,
const std::string& operatorURL)
{
if (licenseURL != "")
{
if (user->getLicenseServiceCertificate(licenseURL) != "")
return;
}
else
{
if (user->getLicenseServiceCertificate(operatorURL) != "")
return;
}
std::string licenseServiceInfoReq = operatorURL + "/LicenseServiceInfo?licenseURL=" + licenseURL;
@ -489,7 +497,10 @@ namespace gourou
std::string certificate = extractTextElem(licenseServicesDoc,
"/licenseServiceInfo/certificate");
if (licenseURL != "")
appendTextElem(root, "adept:licenseURL", licenseURL);
else
appendTextElem(root, "adept:licenseURL", operatorURL);
appendTextElem(root, "adept:certificate", certificate);
user->updateActivationFile(activationDoc);
@ -576,7 +587,7 @@ namespace gourou
fulfillReply.load_string((const char*)replyData.data());
std::string licenseURL = extractTextElem(fulfillReply, "//licenseToken/licenseURL");
std::string licenseURL = extractTextElem(fulfillReply, "//licenseToken/licenseURL", false);
fetchLicenseServiceCertificate(licenseURL, operatorURL);