2023-09-15 18:01:23 -06:00
|
|
|
/*
|
2024-10-04 13:19:50 +02:00
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <andreas@ladybird.org>
|
2023-09-15 18:01:23 -06:00
|
|
|
* Copyright (c) 2023, Andrew Kaster <akaster@serenityos.org>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
2024-08-07 20:55:27 +02:00
|
|
|
#include "LadybirdServiceBase.h"
|
2023-09-15 18:01:23 -06:00
|
|
|
#include <AK/LexicalPath.h>
|
|
|
|
|
#include <AK/OwnPtr.h>
|
|
|
|
|
#include <LibCore/ArgsParser.h>
|
|
|
|
|
#include <LibCore/EventLoop.h>
|
|
|
|
|
#include <LibCore/LocalServer.h>
|
|
|
|
|
#include <LibCore/System.h>
|
|
|
|
|
#include <LibFileSystem/FileSystem.h>
|
|
|
|
|
#include <LibIPC/SingleServer.h>
|
2024-11-24 21:55:03 +01:00
|
|
|
#include <LibTLS/TLSv12.h>
|
2025-06-10 17:49:36 +02:00
|
|
|
#include <LibWebView/Utilities.h>
|
2023-09-15 18:01:23 -06:00
|
|
|
#include <RequestServer/ConnectionFromClient.h>
|
2025-06-10 17:49:36 +02:00
|
|
|
|
|
|
|
|
namespace RequestServer {
|
|
|
|
|
|
|
|
|
|
extern ByteString g_default_certificate_path;
|
|
|
|
|
|
|
|
|
|
}
|
2023-09-15 18:01:23 -06:00
|
|
|
|
2024-05-04 06:08:53 -06:00
|
|
|
ErrorOr<int> service_main(int ipc_socket)
|
2023-09-15 18:01:23 -06:00
|
|
|
{
|
|
|
|
|
|
2025-06-10 17:49:36 +02:00
|
|
|
RequestServer::g_default_certificate_path = ByteString::formatted("{}/res/ladybird/cacert.pem", WebView::s_ladybird_resource_root);
|
|
|
|
|
|
|
|
|
|
Core::EventLoop event_loop;
|
2023-09-15 18:01:23 -06:00
|
|
|
|
|
|
|
|
auto socket = TRY(Core::LocalSocket::adopt_fd(ipc_socket));
|
2025-06-10 17:49:36 +02:00
|
|
|
auto client = TRY(RequestServer::ConnectionFromClient::try_create(make<IPC::Transport>(move(socket))));
|
2023-09-15 18:01:23 -06:00
|
|
|
|
|
|
|
|
return event_loop.exec();
|
|
|
|
|
}
|