/* * Copyright (c) 2018-2020, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include namespace Protocol { class Request; class RequestClient final : public IPC::ServerConnection , public RequestClientEndpoint { C_OBJECT(RequestClient); public: template> RefPtr start_request(String const& method, URL const&, HashMap const& request_headers = {}, ReadonlyBytes request_body = {}); void ensure_connection(URL const&, ::RequestServer::CacheLevel); bool stop_request(Badge, Request&); bool set_certificate(Badge, Request&, String, String); private: RequestClient(); virtual void request_progress(i32, Optional const&, u32) override; virtual void request_finished(i32, bool, u32) override; virtual void certificate_requested(i32) override; virtual void headers_became_available(i32, IPC::Dictionary const&, Optional const&) override; HashMap> m_requests; }; }