Skip to content

Commit

Permalink
Only read "certs" and "named_certs" if available
Browse files Browse the repository at this point in the history
  • Loading branch information
xanderfrangos committed Jan 19, 2024
1 parent ca6d1a2 commit 567725d
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions src/nvhttp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,20 +251,24 @@ namespace nvhttp {
client.uniqueID = uniqID;

// Import from old format
for (auto &[_, el] : device_node.get_child("certs")) {
named_cert_t named_cert;
named_cert.name = ""s;
named_cert.cert = el.get_value<std::string>();
client.named_certs.emplace_back(named_cert);
client.certs.emplace_back(named_cert.cert);
if(device_node.count("certs")) {
for (auto &[_, el] : device_node.get_child("certs")) {
named_cert_t named_cert;
named_cert.name = ""s;
named_cert.cert = el.get_value<std::string>();
client.named_certs.emplace_back(named_cert);
client.certs.emplace_back(named_cert.cert);
}
}

for (auto &[_, el] : device_node.get_child("named_certs")) {
named_cert_t named_cert;
named_cert.name = el.get_child("name").get_value<std::string>();
named_cert.cert = el.get_child("cert").get_value<std::string>();
client.named_certs.emplace_back(named_cert);
client.certs.emplace_back(named_cert.cert);
if(device_node.count("named_certs")) {
for (auto &[_, el] : device_node.get_child("named_certs")) {
named_cert_t named_cert;
named_cert.name = el.get_child("name").get_value<std::string>();
named_cert.cert = el.get_child("cert").get_value<std::string>();
client.named_certs.emplace_back(named_cert);
client.certs.emplace_back(named_cert.cert);
}
}
}
}
Expand Down

0 comments on commit 567725d

Please sign in to comment.