1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:37:35 +00:00

headless-browser: Add ca-certs-path options

This commit is contained in:
leeight 2022-09-30 14:59:37 +08:00 committed by Ali Mohammad Pur
parent c837a1a8de
commit 2eb6dbd4f0
3 changed files with 23 additions and 3 deletions

View file

@ -11,6 +11,7 @@
#include <AK/Optional.h>
#include <AK/Singleton.h>
#include <AK/Types.h>
#include <LibCore/ConfigFile.h>
#include <LibCore/DateTime.h>
#include <LibCrypto/BigInt/UnsignedBigInteger.h>
#include <LibCrypto/PK/RSA.h>
@ -131,6 +132,8 @@ public:
Vector<Certificate> const& certificates() const { return m_ca_certificates; }
void reload_certificates(Core::ConfigFile&);
static DefaultRootCACertificates& the() { return s_the; }
private:

View file

@ -476,10 +476,15 @@ DefaultRootCACertificates::DefaultRootCACertificates()
return;
}
auto config = config_result.release_value();
reload_certificates(config);
}
for (auto& entity : config->groups()) {
for (auto& subject : config->keys(entity)) {
auto certificate_base64 = config->read_entry(entity, subject);
void DefaultRootCACertificates::reload_certificates(Core::ConfigFile& config)
{
m_ca_certificates.clear();
for (auto& entity : config.groups()) {
for (auto& subject : config.keys(entity)) {
auto certificate_base64 = config.read_entry(entity, subject);
auto certificate_data_result = decode_base64(certificate_base64);
if (certificate_data_result.is_error()) {
dbgln("Skipping CA Certificate {} {}: out of memory", entity, subject);