Manage ACSM files that contains server internal error

This commit is contained in:
Grégory Soutadé 2023-01-06 21:17:57 +01:00
parent ab5afa5003
commit fc839e671a
2 changed files with 10 additions and 2 deletions

View File

@ -64,7 +64,8 @@ namespace gourou
FF_INVALID_ACSM_FILE,
FF_NO_HMAC_IN_ACSM_FILE,
FF_NOT_ACTIVATED,
FF_NO_OPERATOR_URL
FF_NO_OPERATOR_URL,
FF_SERVER_INTERNAL_ERROR
};
enum DOWNLOAD_ERROR {

View File

@ -505,6 +505,13 @@ namespace gourou
if (!acsmDoc.load_file(ACSMFile.c_str(), pugi::parse_ws_pcdata_single|pugi::parse_escapes, pugi::encoding_utf8))
EXCEPTION(FF_INVALID_ACSM_FILE, "Invalid ACSM file " << ACSMFile);
// Could be an server internal error
pugi::xml_node rootNode = acsmDoc.first_child();
if (std::string(rootNode.name()) == "error")
{
EXCEPTION(FF_SERVER_INTERNAL_ERROR, rootNode.attribute("data").value());
}
GOUROU_LOG(INFO, "Fulfill " << ACSMFile);
// Build req file
@ -512,7 +519,7 @@ namespace gourou
buildFulfillRequest(acsmDoc, fulfillReq);
pugi::xpath_node root = fulfillReq.select_node("//adept:fulfill");
pugi::xml_node rootNode = root.node();
rootNode = root.node();
// Remove HMAC
pugi::xpath_node xpathRes = fulfillReq.select_node("//hmac");