/* * Copyright (c) 2018-2020, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include // Need to include this before RequestClientEndpoint.h as that one includes LibIPC/(De En)coder.h, which would bomb if included before this. #include #include #include #include namespace Protocol { class Request; class RequestClient final : public IPC::ConnectionToServer , public RequestClientEndpoint { IPC_CLIENT_CONNECTION(RequestClient, "/tmp/portal/request") public: template> RefPtr start_request(String const& method, URL const&, HashMap const& request_headers = {}, ReadonlyBytes request_body = {}, Core::ProxyData const& = {}); void ensure_connection(URL const&, ::RequestServer::CacheLevel); bool stop_request(Badge, Request&); bool set_certificate(Badge, Request&, String, String); private: RequestClient(NonnullOwnPtr); 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; }; }