1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:37:45 +00:00

Everywhere: Rename {Deprecated => Byte}String

This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
Ali Mohammad Pur 2023-12-16 17:49:34 +03:30 committed by Ali Mohammad Pur
parent 38d62563b3
commit 5e1499d104
1615 changed files with 10257 additions and 10257 deletions

View file

@ -24,7 +24,7 @@ bool ContentFilter::is_filtered(const AK::URL& url) const
if (url.scheme() == "data")
return false;
auto url_string = url.to_deprecated_string();
auto url_string = url.to_byte_string();
for (auto& pattern : m_patterns) {
if (url_string.matches(pattern.text, CaseSensitivity::CaseSensitive))

View file

@ -8,13 +8,13 @@
namespace Web {
FileRequest::FileRequest(DeprecatedString path, Function<void(ErrorOr<i32>)> on_file_request_finish_callback)
FileRequest::FileRequest(ByteString path, Function<void(ErrorOr<i32>)> on_file_request_finish_callback)
: on_file_request_finish(move(on_file_request_finish_callback))
, m_path(move(path))
{
}
DeprecatedString FileRequest::path() const
ByteString FileRequest::path() const
{
return m_path;
}

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Error.h>
#include <AK/Function.h>
@ -14,14 +14,14 @@ namespace Web {
class FileRequest {
public:
FileRequest(DeprecatedString path, Function<void(ErrorOr<i32>)> on_file_request_finish);
FileRequest(ByteString path, Function<void(ErrorOr<i32>)> on_file_request_finish);
DeprecatedString path() const;
ByteString path() const;
Function<void(ErrorOr<i32>)> on_file_request_finish;
private:
DeprecatedString m_path {};
ByteString m_path {};
};
}

View file

@ -54,13 +54,13 @@ ErrorOr<String> load_error_page(AK::URL const& url)
{
// Generate HTML error page from error template file
// FIXME: Use an actual templating engine (our own one when it's built, preferably with a way to check these usages at compile time)
auto template_path = AK::URL::create_with_url_or_path(error_page_url().to_deprecated_string()).serialize_path();
auto template_path = AK::URL::create_with_url_or_path(error_page_url().to_byte_string()).serialize_path();
auto template_file = TRY(Core::File::open(template_path, Core::File::OpenMode::Read));
auto template_contents = TRY(template_file->read_until_eof());
StringBuilder builder;
SourceGenerator generator { builder };
generator.set("resource_directory_url", resource_directory_url());
generator.set("failed_url", url.to_deprecated_string());
generator.set("failed_url", url.to_byte_string());
generator.append(template_contents);
return TRY(String::from_utf8(generator.as_string_view()));
}
@ -70,7 +70,7 @@ ErrorOr<String> load_file_directory_page(LoadRequest const& request)
// Generate HTML contents entries table
auto lexical_path = LexicalPath(request.url().serialize_path());
Core::DirIterator dt(lexical_path.string(), Core::DirIterator::Flags::SkipParentAndBaseDir);
Vector<DeprecatedString> names;
Vector<ByteString> names;
while (dt.has_next())
names.append(dt.next_path());
quick_sort(names);
@ -88,7 +88,7 @@ ErrorOr<String> load_file_directory_page(LoadRequest const& request)
contents.appendff("<td><span class=\"{}\"></span></td>", is_directory ? "folder" : "file");
contents.appendff("<td><a href=\"file://{}\">{}</a></td><td>&nbsp;</td>"sv, path, name);
contents.appendff("<td>{:10}</td><td>&nbsp;</td>", is_directory ? "-" : human_readable_size(st.st_size));
contents.appendff("<td>{}</td>"sv, Core::DateTime::from_timestamp(st.st_mtime).to_deprecated_string());
contents.appendff("<td>{}</td>"sv, Core::DateTime::from_timestamp(st.st_mtime).to_byte_string());
contents.append("</tr>\n"sv);
}
}
@ -96,7 +96,7 @@ ErrorOr<String> load_file_directory_page(LoadRequest const& request)
// Generate HTML directory page from directory template file
// FIXME: Use an actual templating engine (our own one when it's built, preferably with a way to check these usages at compile time)
auto template_path = AK::URL::create_with_url_or_path(directory_page_url().to_deprecated_string()).serialize_path();
auto template_path = AK::URL::create_with_url_or_path(directory_page_url().to_byte_string()).serialize_path();
auto template_file = TRY(Core::File::open(template_path, Core::File::OpenMode::Read));
auto template_contents = TRY(template_file->read_until_eof());
StringBuilder builder;
@ -104,7 +104,7 @@ ErrorOr<String> load_file_directory_page(LoadRequest const& request)
generator.set("resource_directory_url", resource_directory_url());
generator.set("path", escape_html_entities(lexical_path.string()));
generator.set("parent_path", escape_html_entities(lexical_path.parent().string()));
generator.set("contents", contents.to_deprecated_string());
generator.set("contents", contents.to_byte_string());
generator.append(template_contents);
return TRY(String::from_utf8(generator.as_string_view()));
}

View file

@ -16,7 +16,7 @@ LoadRequest LoadRequest::create_for_url_on_page(const AK::URL& url, Page* page)
request.set_url(url);
if (page) {
DeprecatedString cookie = page->client().page_did_request_cookie(url, Cookie::Source::Http);
ByteString cookie = page->client().page_did_request_cookie(url, Cookie::Source::Http);
if (!cookie.is_empty())
request.set_header("Cookie", cookie);
request.set_page(*page);

View file

@ -34,8 +34,8 @@ public:
const AK::URL& url() const { return m_url; }
void set_url(const AK::URL& url) { m_url = url; }
DeprecatedString const& method() const { return m_method; }
void set_method(DeprecatedString const& method) { m_method = method; }
ByteString const& method() const { return m_method; }
void set_method(ByteString const& method) { m_method = method; }
ByteBuffer const& body() const { return m_body; }
void set_body(ByteBuffer body) { m_body = move(body); }
@ -50,7 +50,7 @@ public:
{
auto body_hash = string_hash((char const*)m_body.data(), m_body.size());
auto body_and_headers_hash = pair_int_hash(body_hash, m_headers.hash());
auto url_and_method_hash = pair_int_hash(m_url.to_deprecated_string().hash(), m_method.hash());
auto url_and_method_hash = pair_int_hash(m_url.to_byte_string().hash(), m_method.hash());
return pair_int_hash(body_and_headers_hash, url_and_method_hash);
}
@ -68,15 +68,15 @@ public:
return m_url == other.m_url && m_method == other.m_method && m_body == other.m_body;
}
void set_header(DeprecatedString const& name, DeprecatedString const& value) { m_headers.set(name, value); }
DeprecatedString header(DeprecatedString const& name) const { return m_headers.get(name).value_or({}); }
void set_header(ByteString const& name, ByteString const& value) { m_headers.set(name, value); }
ByteString header(ByteString const& name) const { return m_headers.get(name).value_or({}); }
HashMap<DeprecatedString, DeprecatedString, CaseInsensitiveStringTraits> const& headers() const { return m_headers; }
HashMap<ByteString, ByteString, CaseInsensitiveStringTraits> const& headers() const { return m_headers; }
private:
AK::URL m_url;
DeprecatedString m_method { "GET" };
HashMap<DeprecatedString, DeprecatedString, CaseInsensitiveStringTraits> m_headers;
ByteString m_method { "GET" };
HashMap<ByteString, ByteString, CaseInsensitiveStringTraits> m_headers;
ByteBuffer m_body;
Core::ElapsedTimer m_load_timer;
JS::Handle<Page> m_page;

View file

@ -14,7 +14,7 @@ Web::ProxyMappings& Web::ProxyMappings::the()
Core::ProxyData Web::ProxyMappings::proxy_for_url(AK::URL const& url) const
{
auto url_string = url.to_deprecated_string();
auto url_string = url.to_byte_string();
for (auto& it : m_mappings) {
if (url_string.matches(it.key)) {
auto result = Core::ProxyData::parse_url(m_proxies[it.value]);
@ -29,7 +29,7 @@ Core::ProxyData Web::ProxyMappings::proxy_for_url(AK::URL const& url) const
return {};
}
void Web::ProxyMappings::set_mappings(Vector<DeprecatedString> proxies, OrderedHashMap<DeprecatedString, size_t> mappings)
void Web::ProxyMappings::set_mappings(Vector<ByteString> proxies, OrderedHashMap<ByteString, size_t> mappings)
{
m_proxies = move(proxies);
m_mappings = move(mappings);

View file

@ -18,14 +18,14 @@ public:
static ProxyMappings& the();
Core::ProxyData proxy_for_url(AK::URL const&) const;
void set_mappings(Vector<DeprecatedString> proxies, OrderedHashMap<DeprecatedString, size_t> mappings);
void set_mappings(Vector<ByteString> proxies, OrderedHashMap<ByteString, size_t> mappings);
private:
ProxyMappings() = default;
~ProxyMappings() = default;
Vector<DeprecatedString> m_proxies;
OrderedHashMap<DeprecatedString, size_t> m_mappings;
Vector<ByteString> m_proxies;
OrderedHashMap<ByteString, size_t> m_mappings;
};
}

View file

@ -54,7 +54,7 @@ void Resource::for_each_client(Function<void(ResourceClient&)> callback)
}
}
static Optional<DeprecatedString> encoding_from_content_type(DeprecatedString const& content_type)
static Optional<ByteString> encoding_from_content_type(ByteString const& content_type)
{
auto offset = content_type.find("charset="sv);
if (offset.has_value()) {
@ -69,7 +69,7 @@ static Optional<DeprecatedString> encoding_from_content_type(DeprecatedString co
return {};
}
static DeprecatedString mime_type_from_content_type(DeprecatedString const& content_type)
static ByteString mime_type_from_content_type(ByteString const& content_type)
{
auto offset = content_type.find(';');
if (offset.has_value())
@ -83,7 +83,7 @@ static bool is_valid_encoding(StringView encoding)
return TextCodec::decoder_for(encoding).has_value();
}
void Resource::did_load(Badge<ResourceLoader>, ReadonlyBytes data, HashMap<DeprecatedString, DeprecatedString, CaseInsensitiveStringTraits> const& headers, Optional<u32> status_code)
void Resource::did_load(Badge<ResourceLoader>, ReadonlyBytes data, HashMap<ByteString, ByteString, CaseInsensitiveStringTraits> const& headers, Optional<u32> status_code)
{
VERIFY(m_state == State::Pending);
// FIXME: Handle OOM failure.
@ -125,7 +125,7 @@ void Resource::did_load(Badge<ResourceLoader>, ReadonlyBytes data, HashMap<Depre
});
}
void Resource::did_fail(Badge<ResourceLoader>, DeprecatedString const& error, Optional<u32> status_code)
void Resource::did_fail(Badge<ResourceLoader>, ByteString const& error, Optional<u32> status_code)
{
m_error = error;
m_status_code = move(status_code);

View file

@ -46,14 +46,14 @@ public:
bool is_loaded() const { return m_state == State::Loaded; }
bool is_failed() const { return m_state == State::Failed; }
DeprecatedString const& error() const { return m_error; }
ByteString const& error() const { return m_error; }
bool has_encoded_data() const { return !m_encoded_data.is_empty(); }
const AK::URL& url() const { return m_request.url(); }
ByteBuffer const& encoded_data() const { return m_encoded_data; }
HashMap<DeprecatedString, DeprecatedString, CaseInsensitiveStringTraits> const& response_headers() const { return m_response_headers; }
HashMap<ByteString, ByteString, CaseInsensitiveStringTraits> const& response_headers() const { return m_response_headers; }
[[nodiscard]] Optional<u32> status_code() const { return m_status_code; }
@ -61,13 +61,13 @@ public:
void unregister_client(Badge<ResourceClient>, ResourceClient&);
bool has_encoding() const { return m_encoding.has_value(); }
Optional<DeprecatedString> const& encoding() const { return m_encoding; }
DeprecatedString const& mime_type() const { return m_mime_type; }
Optional<ByteString> const& encoding() const { return m_encoding; }
ByteString const& mime_type() const { return m_mime_type; }
void for_each_client(Function<void(ResourceClient&)>);
void did_load(Badge<ResourceLoader>, ReadonlyBytes data, HashMap<DeprecatedString, DeprecatedString, CaseInsensitiveStringTraits> const& headers, Optional<u32> status_code);
void did_fail(Badge<ResourceLoader>, DeprecatedString const& error, Optional<u32> status_code);
void did_load(Badge<ResourceLoader>, ReadonlyBytes data, HashMap<ByteString, ByteString, CaseInsensitiveStringTraits> const& headers, Optional<u32> status_code);
void did_fail(Badge<ResourceLoader>, ByteString const& error, Optional<u32> status_code);
protected:
explicit Resource(Type, LoadRequest const&);
@ -80,11 +80,11 @@ private:
ByteBuffer m_encoded_data;
Type m_type { Type::Generic };
State m_state { State::Pending };
DeprecatedString m_error;
Optional<DeprecatedString> m_encoding;
ByteString m_error;
Optional<ByteString> m_encoding;
DeprecatedString m_mime_type;
HashMap<DeprecatedString, DeprecatedString, CaseInsensitiveStringTraits> m_response_headers;
ByteString m_mime_type;
HashMap<ByteString, ByteString, CaseInsensitiveStringTraits> m_response_headers;
Optional<u32> m_status_code;
HashTable<ResourceClient*> m_clients;
};

View file

@ -122,14 +122,14 @@ RefPtr<Resource> ResourceLoader::load_resource(Resource::Type type, LoadRequest&
return resource;
}
static DeprecatedString sanitized_url_for_logging(AK::URL const& url)
static ByteString sanitized_url_for_logging(AK::URL const& url)
{
if (url.scheme() == "data"sv)
return "[data URL]"sv;
return url.to_deprecated_string();
return url.to_byte_string();
}
static void emit_signpost(DeprecatedString const& message, int id)
static void emit_signpost(ByteString const& message, int id)
{
#ifdef AK_OS_SERENITY
auto string_id = perf_register_string(message.characters(), message.length());
@ -140,7 +140,7 @@ static void emit_signpost(DeprecatedString const& message, int id)
#endif
}
static void store_response_cookies(Page& page, AK::URL const& url, DeprecatedString const& cookies)
static void store_response_cookies(Page& page, AK::URL const& url, ByteString const& cookies)
{
auto set_cookie_json_value = MUST(JsonValue::from_string(cookies));
VERIFY(set_cookie_json_value.type() == JsonValue::Type::Array);
@ -165,23 +165,23 @@ void ResourceLoader::load(LoadRequest& request, SuccessCallback success_callback
auto id = resource_id++;
auto url_for_logging = sanitized_url_for_logging(url);
emit_signpost(DeprecatedString::formatted("Starting load: {}", url_for_logging), id);
emit_signpost(ByteString::formatted("Starting load: {}", url_for_logging), id);
dbgln_if(SPAM_DEBUG, "ResourceLoader: Starting load of: \"{}\"", url_for_logging);
auto const log_success = [url_for_logging, id](auto const& request) {
auto load_time_ms = request.load_time().to_milliseconds();
emit_signpost(DeprecatedString::formatted("Finished load: {}", url_for_logging), id);
emit_signpost(ByteString::formatted("Finished load: {}", url_for_logging), id);
dbgln_if(SPAM_DEBUG, "ResourceLoader: Finished load of: \"{}\", Duration: {}ms", url_for_logging, load_time_ms);
};
auto const log_failure = [url_for_logging, id](auto const& request, auto const& error_message) {
auto load_time_ms = request.load_time().to_milliseconds();
emit_signpost(DeprecatedString::formatted("Failed load: {}", url_for_logging), id);
emit_signpost(ByteString::formatted("Failed load: {}", url_for_logging), id);
dbgln("ResourceLoader: Failed load of: \"{}\", \033[31;1mError: {}\033[0m, Duration: {}ms", url_for_logging, error_message, load_time_ms);
};
if (is_port_blocked(url.port_or_default())) {
log_failure(request, DeprecatedString::formatted("The port #{} is blocked", url.port_or_default()));
log_failure(request, ByteString::formatted("The port #{} is blocked", url.port_or_default()));
return;
}
@ -196,11 +196,11 @@ void ResourceLoader::load(LoadRequest& request, SuccessCallback success_callback
dbgln_if(SPAM_DEBUG, "Loading about: URL {}", url);
log_success(request);
HashMap<DeprecatedString, DeprecatedString, CaseInsensitiveStringTraits> response_headers;
HashMap<ByteString, ByteString, CaseInsensitiveStringTraits> response_headers;
response_headers.set("Content-Type", "text/html; charset=UTF-8");
Platform::EventLoopPlugin::the().deferred_invoke([success_callback = move(success_callback), response_headers = move(response_headers)] {
success_callback(DeprecatedString::empty().to_byte_buffer(), response_headers, {});
success_callback(ByteString::empty().to_byte_buffer(), response_headers, {});
});
return;
}
@ -219,8 +219,8 @@ void ResourceLoader::load(LoadRequest& request, SuccessCallback success_callback
data_url.mime_type,
StringView(data_url.body.bytes()));
HashMap<DeprecatedString, DeprecatedString, CaseInsensitiveStringTraits> response_headers;
response_headers.set("Content-Type", data_url.mime_type.to_deprecated_string());
HashMap<ByteString, ByteString, CaseInsensitiveStringTraits> response_headers;
response_headers.set("Content-Type", data_url.mime_type.to_byte_string());
log_success(request);
@ -248,7 +248,7 @@ void ResourceLoader::load(LoadRequest& request, SuccessCallback success_callback
log_failure(request, file_or_error.error());
if (error_callback) {
auto status = file_or_error.error().code() == ENOENT ? 404u : 500u;
error_callback(DeprecatedString::formatted("{}", file_or_error.error()), status, {}, {});
error_callback(ByteString::formatted("{}", file_or_error.error()), status, {}, {});
}
return;
}
@ -262,12 +262,12 @@ void ResourceLoader::load(LoadRequest& request, SuccessCallback success_callback
if (maybe_response.is_error()) {
log_failure(request, maybe_response.error());
if (error_callback)
error_callback(DeprecatedString::formatted("{}", maybe_response.error()), 500u, {}, {});
error_callback(ByteString::formatted("{}", maybe_response.error()), 500u, {}, {});
return;
}
log_success(request);
HashMap<DeprecatedString, DeprecatedString, CaseInsensitiveStringTraits> response_headers;
HashMap<ByteString, ByteString, CaseInsensitiveStringTraits> response_headers;
response_headers.set("Content-Type"sv, "text/html"sv);
success_callback(maybe_response.release_value().bytes(), response_headers, {});
return;
@ -278,7 +278,7 @@ void ResourceLoader::load(LoadRequest& request, SuccessCallback success_callback
if (maybe_file.is_error()) {
log_failure(request, maybe_file.error());
if (error_callback)
error_callback(DeprecatedString::formatted("{}", maybe_file.error()), 500u, {}, {});
error_callback(ByteString::formatted("{}", maybe_file.error()), 500u, {}, {});
return;
}
@ -287,7 +287,7 @@ void ResourceLoader::load(LoadRequest& request, SuccessCallback success_callback
if (maybe_data.is_error()) {
log_failure(request, maybe_data.error());
if (error_callback)
error_callback(DeprecatedString::formatted("{}", maybe_data.error()), 500u, {}, {});
error_callback(ByteString::formatted("{}", maybe_data.error()), 500u, {}, {});
return;
}
auto data = maybe_data.release_value();
@ -295,7 +295,7 @@ void ResourceLoader::load(LoadRequest& request, SuccessCallback success_callback
// NOTE: For file:// URLs, we have to guess the MIME type, since there's no HTTP header to tell us what this is.
// We insert a fake Content-Type header here, so that clients can use it to learn the MIME type.
HashMap<DeprecatedString, DeprecatedString, CaseInsensitiveStringTraits> response_headers;
HashMap<ByteString, ByteString, CaseInsensitiveStringTraits> response_headers;
auto mime_type = Core::guess_mime_type_based_on_filename(request.url().serialize_path());
response_headers.set("Content-Type"sv, mime_type);
@ -314,8 +314,8 @@ void ResourceLoader::load(LoadRequest& request, SuccessCallback success_callback
if (url.scheme() == "http" || url.scheme() == "https" || url.scheme() == "gemini") {
auto proxy = ProxyMappings::the().proxy_for_url(url);
HashMap<DeprecatedString, DeprecatedString> headers;
headers.set("User-Agent", m_user_agent.to_deprecated_string());
HashMap<ByteString, ByteString> headers;
headers.set("User-Agent", m_user_agent.to_byte_string());
headers.set("Accept-Encoding", "gzip, deflate, br");
for (auto& it : request.headers()) {
@ -366,7 +366,7 @@ void ResourceLoader::load(LoadRequest& request, SuccessCallback success_callback
error_builder.append("Load failed"sv);
log_failure(request, error_builder.string_view());
if (error_callback)
error_callback(error_builder.to_deprecated_string(), status_code, payload, response_headers);
error_callback(error_builder.to_byte_string(), status_code, payload, response_headers);
return;
}
log_success(request);
@ -385,7 +385,7 @@ void ResourceLoader::load(LoadRequest& request, SuccessCallback success_callback
return;
}
auto not_implemented_error = DeprecatedString::formatted("Protocol not implemented: {}", url.scheme());
auto not_implemented_error = ByteString::formatted("Protocol not implemented: {}", url.scheme());
log_failure(request, not_implemented_error);
if (error_callback)
error_callback(not_implemented_error, {}, {}, {});

View file

@ -7,7 +7,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Function.h>
#include <AK/HashMap.h>
#include <AK/URL.h>
@ -69,8 +69,8 @@ public:
virtual ~ResourceLoaderConnectorRequest();
struct CertificateAndKey {
DeprecatedString certificate;
DeprecatedString key;
ByteString certificate;
ByteString key;
};
virtual void set_should_buffer_all_input(bool) = 0;
@ -78,7 +78,7 @@ public:
virtual void stream_into(Stream&) = 0;
Function<void(bool success, u64 total_size, HashMap<DeprecatedString, DeprecatedString, CaseInsensitiveStringTraits> const& response_headers, Optional<u32> response_code, ReadonlyBytes payload)> on_buffered_request_finish;
Function<void(bool success, u64 total_size, HashMap<ByteString, ByteString, CaseInsensitiveStringTraits> const& response_headers, Optional<u32> response_code, ReadonlyBytes payload)> on_buffered_request_finish;
Function<void(bool success, u64 total_size)> on_finish;
Function<void(Optional<u64> total_size, u64 downloaded_size)> on_progress;
Function<CertificateAndKey()> on_certificate_requested;
@ -94,7 +94,7 @@ public:
virtual void prefetch_dns(AK::URL const&) = 0;
virtual void preconnect(AK::URL const&) = 0;
virtual RefPtr<ResourceLoaderConnectorRequest> start_request(DeprecatedString const& method, AK::URL const&, HashMap<DeprecatedString, DeprecatedString> const& request_headers = {}, ReadonlyBytes request_body = {}, Core::ProxyData const& = {}) = 0;
virtual RefPtr<ResourceLoaderConnectorRequest> start_request(ByteString const& method, AK::URL const&, HashMap<ByteString, ByteString> const& request_headers = {}, ReadonlyBytes request_body = {}, Core::ProxyData const& = {}) = 0;
protected:
explicit ResourceLoaderConnector();
@ -108,8 +108,8 @@ public:
RefPtr<Resource> load_resource(Resource::Type, LoadRequest&);
using SuccessCallback = Function<void(ReadonlyBytes, HashMap<DeprecatedString, DeprecatedString, CaseInsensitiveStringTraits> const& response_headers, Optional<u32> status_code)>;
using ErrorCallback = Function<void(DeprecatedString const&, Optional<u32> status_code, ReadonlyBytes payload, HashMap<DeprecatedString, DeprecatedString, CaseInsensitiveStringTraits> const& response_headers)>;
using SuccessCallback = Function<void(ReadonlyBytes, HashMap<ByteString, ByteString, CaseInsensitiveStringTraits> const& response_headers, Optional<u32> status_code)>;
using ErrorCallback = Function<void(ByteString const&, Optional<u32> status_code, ReadonlyBytes payload, HashMap<ByteString, ByteString, CaseInsensitiveStringTraits> const& response_headers)>;
using TimeoutCallback = Function<void()>;
void load(LoadRequest&, SuccessCallback success_callback, ErrorCallback error_callback = nullptr, Optional<u32> timeout = {}, TimeoutCallback timeout_callback = nullptr);