1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:07:35 +00:00

WebServer: Add Content-Length header to HTTP responses

This makes the browser know how much data it should expect.
This commit is contained in:
Maciej 2022-03-18 18:58:29 +01:00 committed by Andreas Kling
parent b6f358689c
commit c1ca009939
2 changed files with 29 additions and 23 deletions

View file

@ -22,8 +22,13 @@ public:
private:
Client(NonnullOwnPtr<Core::Stream::BufferedTCPSocket>, Core::Object* parent);
struct ContentInfo {
String type;
size_t length {};
};
ErrorOr<bool> handle_request(ReadonlyBytes);
ErrorOr<void> send_response(InputStream&, HTTP::HttpRequest const&, String const& content_type);
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<String> const& headers = {});
void die();