RequestServer: Use libcurl for HTTP and HTTPS downloads

This replaces the use of our home-grown implementations inherited
from SerenityOS.
This commit is contained in:
Andreas Kling
2024-09-05 13:20:09 +02:00
committed by Andreas Kling
parent 9772afcd29
commit e483bb70f0
5 changed files with 318 additions and 188 deletions

View File

@@ -24,6 +24,10 @@
# include <LibCore/Platform/ProcessStatisticsMach.h>
#endif
namespace RequestServer {
extern ByteString g_default_certificate_path;
}
static ErrorOr<ByteString> find_certificates(StringView serenity_resource_root)
{
auto cert_path = ByteString::formatted("{}/ladybird/cacert.pem", serenity_resource_root);
@@ -54,6 +58,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
// Ensure the certificates are read out here.
if (certificates.is_empty())
certificates.append(TRY(find_certificates(serenity_resource_root)));
else
RequestServer::g_default_certificate_path = certificates.first();
DefaultRootCACertificates::set_default_certificate_paths(certificates.span());
[[maybe_unused]] auto& certs = DefaultRootCACertificates::the();