2021-04-23 23:45:52 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/HashMap.h>
|
2022-02-25 13:18:30 +03:00
|
|
|
#include <LibIPC/ConnectionFromClient.h>
|
2021-04-23 23:45:52 +03:00
|
|
|
#include <RequestServer/Forward.h>
|
|
|
|
#include <RequestServer/RequestClientEndpoint.h>
|
|
|
|
#include <RequestServer/RequestServerEndpoint.h>
|
|
|
|
|
|
|
|
namespace RequestServer {
|
|
|
|
|
2022-02-25 13:18:30 +03:00
|
|
|
class ConnectionFromClient final
|
|
|
|
: public IPC::ConnectionFromClient<RequestClientEndpoint, RequestServerEndpoint> {
|
|
|
|
C_OBJECT(ConnectionFromClient);
|
2021-04-23 23:45:52 +03:00
|
|
|
|
|
|
|
public:
|
2022-03-24 05:58:03 +03:00
|
|
|
~ConnectionFromClient() override = default;
|
2021-04-23 23:45:52 +03:00
|
|
|
|
|
|
|
virtual void die() override;
|
|
|
|
|
|
|
|
void did_receive_headers(Badge<Request>, Request&);
|
|
|
|
void did_finish_request(Badge<Request>, Request&, bool success);
|
|
|
|
void did_progress_request(Badge<Request>, Request&);
|
|
|
|
void did_request_certificates(Badge<Request>, Request&);
|
|
|
|
|
|
|
|
private:
|
2023-02-09 01:05:44 +03:00
|
|
|
explicit ConnectionFromClient(NonnullOwnPtr<Core::LocalSocket>);
|
2021-11-01 01:38:04 +03:00
|
|
|
|
2023-12-16 17:19:34 +03:00
|
|
|
virtual Messages::RequestServer::IsSupportedProtocolResponse is_supported_protocol(ByteString const&) override;
|
|
|
|
virtual Messages::RequestServer::StartRequestResponse start_request(ByteString const&, URL const&, HashMap<ByteString, ByteString> const&, ByteBuffer const&, Core::ProxyData const&) override;
|
2021-05-02 20:54:34 +03:00
|
|
|
virtual Messages::RequestServer::StopRequestResponse stop_request(i32) override;
|
2023-12-16 17:19:34 +03:00
|
|
|
virtual Messages::RequestServer::SetCertificateResponse set_certificate(i32, ByteString const&, ByteString const&) override;
|
2021-09-27 23:36:52 +03:00
|
|
|
virtual void ensure_connection(URL const& url, ::RequestServer::CacheLevel const& cache_level) override;
|
2021-04-23 23:45:52 +03:00
|
|
|
|
|
|
|
HashMap<i32, OwnPtr<Request>> m_requests;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|