1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:47:44 +00:00

WebServer: Use new String type internally as much as possible

Here, we try to use the new String type for everything internal,
keeping the public interface and the interface to other code the same.
This commit is contained in:
Thomas Keppler 2022-12-20 16:46:30 +01:00 committed by Andreas Kling
parent 1d6528b94b
commit dc8be499e6
2 changed files with 24 additions and 15 deletions

View file

@ -1,11 +1,13 @@
/*
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2022, Thomas Keppler <serenity@tkeppler.de>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/String.h>
#include <LibCore/Object.h>
#include <LibCore/Stream.h>
#include <LibHTTP/Forward.h>
@ -23,17 +25,17 @@ private:
Client(NonnullOwnPtr<Core::Stream::BufferedTCPSocket>, Core::Object* parent);
struct ContentInfo {
DeprecatedString type;
String type;
size_t length {};
};
ErrorOr<bool> handle_request(ReadonlyBytes);
ErrorOr<void> send_response(InputStream&, HTTP::HttpRequest const&, ContentInfo);
ErrorOr<void> send_redirect(StringView redirect, HTTP::HttpRequest const&);
ErrorOr<void> send_error_response(unsigned code, HTTP::HttpRequest const&, Vector<DeprecatedString> const& headers = {});
ErrorOr<void> send_error_response(unsigned code, HTTP::HttpRequest const&, Vector<String> const& headers = {});
void die();
void log_response(unsigned code, HTTP::HttpRequest const&);
ErrorOr<void> handle_directory_listing(DeprecatedString const& requested_path, DeprecatedString const& real_path, HTTP::HttpRequest const&);
ErrorOr<void> handle_directory_listing(String const& requested_path, String const& real_path, HTTP::HttpRequest const&);
bool verify_credentials(Vector<HTTP::HttpRequest::Header> const&);
NonnullOwnPtr<Core::Stream::BufferedTCPSocket> m_socket;