diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2021-09-28 00:06:52 +0330 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-28 22:32:31 +0200 |
commit | 3ec39fc62e5f7a5dd3ce5251777b909220f6cec3 (patch) | |
tree | e37a48e5bc92fb45978b795168f351de117767fc /Userland/Libraries/LibProtocol | |
parent | 6b2e4f896be8a096fbd18f1c65c1266456de8808 (diff) | |
download | serenity-3ec39fc62e5f7a5dd3ce5251777b909220f6cec3.zip |
RequestServer+LibProtocol: Add an 'EnsureConnection' IPC endpoint
This will allow LibWeb (and other components) to request a connection to
be premade and cached, to make subsequent loads faster.
Diffstat (limited to 'Userland/Libraries/LibProtocol')
-rw-r--r-- | Userland/Libraries/LibProtocol/RequestClient.cpp | 5 | ||||
-rw-r--r-- | Userland/Libraries/LibProtocol/RequestClient.h | 2 |
2 files changed, 7 insertions, 0 deletions
diff --git a/Userland/Libraries/LibProtocol/RequestClient.cpp b/Userland/Libraries/LibProtocol/RequestClient.cpp index 00a3f57c58..1449468334 100644 --- a/Userland/Libraries/LibProtocol/RequestClient.cpp +++ b/Userland/Libraries/LibProtocol/RequestClient.cpp @@ -15,6 +15,11 @@ RequestClient::RequestClient() { } +void RequestClient::ensure_connection(URL const& url, ::RequestServer::CacheLevel cache_level) +{ + async_ensure_connection(url, cache_level); +} + template<typename RequestHashMapTraits> RefPtr<Request> RequestClient::start_request(String const& method, URL const& url, HashMap<String, String, RequestHashMapTraits> const& request_headers, ReadonlyBytes request_body) { diff --git a/Userland/Libraries/LibProtocol/RequestClient.h b/Userland/Libraries/LibProtocol/RequestClient.h index 7ad2a2fe24..82248e9e3a 100644 --- a/Userland/Libraries/LibProtocol/RequestClient.h +++ b/Userland/Libraries/LibProtocol/RequestClient.h @@ -24,6 +24,8 @@ public: template<typename RequestHashMapTraits = Traits<String>> RefPtr<Request> start_request(String const& method, URL const&, HashMap<String, String, RequestHashMapTraits> const& request_headers = {}, ReadonlyBytes request_body = {}); + void ensure_connection(URL const&, ::RequestServer::CacheLevel); + bool stop_request(Badge<Request>, Request&); bool set_certificate(Badge<Request>, Request&, String, String); |