summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Loader
diff options
context:
space:
mode:
authorDexesTTP <dexes.ttp@gmail.com>2021-04-23 22:45:52 +0200
committerLinus Groh <mail@linusgroh.de>2021-04-25 19:04:34 +0200
commit71d27abb97acc656256f3fef6d2a67878d520f12 (patch)
tree64fb2a7ee9df5398e3c09195ea2f388230feca91 /Userland/Libraries/LibWeb/Loader
parent22413ef729ffe995c5ef3a9f8fb69567ed913980 (diff)
downloadserenity-71d27abb97acc656256f3fef6d2a67878d520f12.zip
Services: Rename ProtocolServer to RequestServer
The current ProtocolServer was really only used for requests, and with the recent introduction of the WebSocket service, long-lasting connections with another server are not part of it. To better reflect this, this commit renames it to RequestServer. This commit also changes the existing 'protocol' portal to 'request', the existing 'protocol' user and group to 'request', and most mentions of the 'download' aspect of the request to 'request' when relevant, to make everything consistent across the system. Note that LibProtocol still exists as-is, but the more generic Client class and the more specific Download class have both been renamed to a more accurate RequestClient and Request to match the new names. This commit only change names, not behaviors.
Diffstat (limited to 'Userland/Libraries/LibWeb/Loader')
-rw-r--r--Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp22
-rw-r--r--Userland/Libraries/LibWeb/Loader/ResourceLoader.h6
2 files changed, 14 insertions, 14 deletions
diff --git a/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp b/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp
index 5331d1bb53..e8b144449a 100644
--- a/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp
+++ b/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp
@@ -9,8 +9,8 @@
#include <AK/JsonObject.h>
#include <LibCore/EventLoop.h>
#include <LibCore/File.h>
-#include <LibProtocol/Client.h>
-#include <LibProtocol/Download.h>
+#include <LibProtocol/Request.h>
+#include <LibProtocol/RequestClient.h>
#include <LibWeb/Loader/ContentFilter.h>
#include <LibWeb/Loader/LoadRequest.h>
#include <LibWeb/Loader/Resource.h>
@@ -27,7 +27,7 @@ ResourceLoader& ResourceLoader::the()
}
ResourceLoader::ResourceLoader()
- : m_protocol_client(Protocol::Client::construct())
+ : m_protocol_client(Protocol::RequestClient::construct())
, m_user_agent(default_user_agent)
{
}
@@ -156,13 +156,13 @@ void ResourceLoader::load(const LoadRequest& request, Function<void(ReadonlyByte
headers.set(it.key, it.value);
}
- auto download = protocol_client().start_download(request.method(), url.to_string_encoded(), headers, request.body());
- if (!download) {
+ auto protocol_request = protocol_client().start_request(request.method(), url.to_string_encoded(), headers, request.body());
+ if (!protocol_request) {
if (error_callback)
error_callback("Failed to initiate load", {});
return;
}
- download->on_buffered_download_finish = [this, success_callback = move(success_callback), error_callback = move(error_callback), download](bool success, auto, auto& response_headers, auto status_code, ReadonlyBytes payload) {
+ protocol_request->on_buffered_request_finish = [this, success_callback = move(success_callback), error_callback = move(error_callback), protocol_request](bool success, auto, auto& response_headers, auto status_code, ReadonlyBytes payload) {
--m_pending_loads;
if (on_load_counter_change)
on_load_counter_change();
@@ -171,14 +171,14 @@ void ResourceLoader::load(const LoadRequest& request, Function<void(ReadonlyByte
error_callback("HTTP load failed", {});
return;
}
- deferred_invoke([download](auto&) {
- // Clear circular reference of `download` captured by copy
- const_cast<Protocol::Download&>(*download).on_buffered_download_finish = nullptr;
+ deferred_invoke([protocol_request](auto&) {
+ // Clear circular reference of `protocol_request` captured by copy
+ const_cast<Protocol::Request&>(*protocol_request).on_buffered_request_finish = nullptr;
});
success_callback(payload, response_headers, status_code);
};
- download->set_should_buffer_all_input(true);
- download->on_certificate_requested = []() -> Protocol::Download::CertificateAndKey {
+ protocol_request->set_should_buffer_all_input(true);
+ protocol_request->on_certificate_requested = []() -> Protocol::Request::CertificateAndKey {
return {};
};
++m_pending_loads;
diff --git a/Userland/Libraries/LibWeb/Loader/ResourceLoader.h b/Userland/Libraries/LibWeb/Loader/ResourceLoader.h
index 50d535ff97..867825c44d 100644
--- a/Userland/Libraries/LibWeb/Loader/ResourceLoader.h
+++ b/Userland/Libraries/LibWeb/Loader/ResourceLoader.h
@@ -12,7 +12,7 @@
#include <LibWeb/Loader/Resource.h>
namespace Protocol {
-class Client;
+class RequestClient;
}
namespace Web {
@@ -34,7 +34,7 @@ public:
int pending_loads() const { return m_pending_loads; }
- Protocol::Client& protocol_client() { return *m_protocol_client; }
+ Protocol::RequestClient& protocol_client() { return *m_protocol_client; }
const String& user_agent() const { return m_user_agent; }
void set_user_agent(const String& user_agent) { m_user_agent = user_agent; }
@@ -47,7 +47,7 @@ private:
int m_pending_loads { 0 };
- RefPtr<Protocol::Client> m_protocol_client;
+ RefPtr<Protocol::RequestClient> m_protocol_client;
String m_user_agent;
};