mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:17:35 +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:
parent
38d62563b3
commit
5e1499d104
1615 changed files with 10257 additions and 10257 deletions
|
@ -79,7 +79,7 @@ ErrorOr<void, Client::WrappedError> Client::on_ready_to_read()
|
|||
return {};
|
||||
|
||||
auto request = TRY(m_remaining_request.to_byte_buffer());
|
||||
dbgln_if(WEBSERVER_DEBUG, "Got raw request: '{}'", DeprecatedString::copy(request));
|
||||
dbgln_if(WEBSERVER_DEBUG, "Got raw request: '{}'", ByteString::copy(request));
|
||||
|
||||
auto maybe_parsed_request = HTTP::HttpRequest::from_raw_request(TRY(m_remaining_request.to_byte_buffer()));
|
||||
if (maybe_parsed_request.is_error()) {
|
||||
|
@ -125,7 +125,7 @@ ErrorOr<bool> Client::handle_request(HTTP::HttpRequest const& request)
|
|||
}
|
||||
}
|
||||
|
||||
auto requested_path = TRY(String::from_deprecated_string(LexicalPath::join("/"sv, resource_decoded).string()));
|
||||
auto requested_path = TRY(String::from_byte_string(LexicalPath::join("/"sv, resource_decoded).string()));
|
||||
dbgln_if(WEBSERVER_DEBUG, "Canonical requested path: '{}'", requested_path);
|
||||
|
||||
auto real_path = TRY(String::formatted("{}{}", Configuration::the().document_root_path(), requested_path));
|
||||
|
@ -240,24 +240,24 @@ ErrorOr<void> Client::send_redirect(StringView redirect_path, HTTP::HttpRequest
|
|||
return {};
|
||||
}
|
||||
|
||||
static DeprecatedString folder_image_data()
|
||||
static ByteString folder_image_data()
|
||||
{
|
||||
static DeprecatedString cache;
|
||||
static ByteString cache;
|
||||
if (cache.is_empty()) {
|
||||
auto file = Core::MappedFile::map("/res/icons/16x16/filetype-folder.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
// FIXME: change to TRY() and make method fallible
|
||||
cache = MUST(encode_base64(file->bytes())).to_deprecated_string();
|
||||
cache = MUST(encode_base64(file->bytes())).to_byte_string();
|
||||
}
|
||||
return cache;
|
||||
}
|
||||
|
||||
static DeprecatedString file_image_data()
|
||||
static ByteString file_image_data()
|
||||
{
|
||||
static DeprecatedString cache;
|
||||
static ByteString cache;
|
||||
if (cache.is_empty()) {
|
||||
auto file = Core::MappedFile::map("/res/icons/16x16/filetype-unknown.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
// FIXME: change to TRY() and make method fallible
|
||||
cache = MUST(encode_base64(file->bytes())).to_deprecated_string();
|
||||
cache = MUST(encode_base64(file->bytes())).to_byte_string();
|
||||
}
|
||||
return cache;
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ ErrorOr<void> Client::handle_directory_listing(String const& requested_path, Str
|
|||
TRY(builder.try_append("<code><table>\n"sv));
|
||||
|
||||
Core::DirIterator dt(real_path.bytes_as_string_view());
|
||||
Vector<DeprecatedString> names;
|
||||
Vector<ByteString> names;
|
||||
while (dt.has_next())
|
||||
TRY(names.try_append(dt.next_path()));
|
||||
quick_sort(names);
|
||||
|
@ -337,7 +337,7 @@ ErrorOr<void> Client::handle_directory_listing(String const& requested_path, Str
|
|||
TRY(builder.try_append("</body>\n"sv));
|
||||
TRY(builder.try_append("</html>\n"sv));
|
||||
|
||||
auto response = builder.to_deprecated_string();
|
||||
auto response = builder.to_byte_string();
|
||||
FixedMemoryStream stream { response.bytes() };
|
||||
return send_response(stream, request, { .type = "text/html"_string, .length = response.length() });
|
||||
}
|
||||
|
@ -373,7 +373,7 @@ ErrorOr<void> Client::send_error_response(unsigned code, HTTP::HttpRequest const
|
|||
|
||||
void Client::log_response(unsigned code, HTTP::HttpRequest const& request)
|
||||
{
|
||||
outln("{} :: {:03d} :: {} {}", Core::DateTime::now().to_deprecated_string(), code, request.method_name(), request.url().serialize().substring(1));
|
||||
outln("{} :: {:03d} :: {} {}", Core::DateTime::now().to_byte_string(), code, request.method_name(), request.url().serialize().substring(1));
|
||||
}
|
||||
|
||||
bool Client::verify_credentials(Vector<HTTP::HttpRequest::Header> const& headers)
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <LibHTTP/HttpRequest.h>
|
||||
|
||||
|
|
|
@ -26,11 +26,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
static auto const default_port = 8000;
|
||||
static auto const default_document_root_path = "/www"_string;
|
||||
|
||||
DeprecatedString listen_address = default_listen_address.to_deprecated_string();
|
||||
ByteString listen_address = default_listen_address.to_byte_string();
|
||||
int port = default_port;
|
||||
DeprecatedString username;
|
||||
DeprecatedString password;
|
||||
DeprecatedString document_root_path = default_document_root_path.to_deprecated_string();
|
||||
ByteString username;
|
||||
ByteString password;
|
||||
ByteString document_root_path = default_document_root_path.to_byte_string();
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(listen_address, "IP address to listen on", "listen-address", 'l', "listen_address");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue