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

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