/* * Copyright (c) 2018-2020, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include namespace Protocol { class Request; class RequestClient : public IPC::ServerConnection , public RequestClientEndpoint { C_OBJECT(RequestClient); public: virtual void handshake() override; template> RefPtr start_request(const String& method, const String& url, const HashMap& request_headers = {}, ReadonlyBytes request_body = {}); 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; }; }