summaryrefslogtreecommitdiff
path: root/Userland/Services/WebServer/Client.h
diff options
context:
space:
mode:
authorMaciej <sppmacd@pm.me>2022-03-18 18:58:29 +0100
committerAndreas Kling <kling@serenityos.org>2022-03-19 22:03:51 +0100
commitc1ca009939917ed68e3c464592e60e3cb788425a (patch)
treee54b0a718796117ccf32a166f37122a861a23b24 /Userland/Services/WebServer/Client.h
parentb6f358689cb3ece58e3cfef0ee7177b66405fe76 (diff)
downloadserenity-c1ca009939917ed68e3c464592e60e3cb788425a.zip
WebServer: Add Content-Length header to HTTP responses
This makes the browser know how much data it should expect.
Diffstat (limited to 'Userland/Services/WebServer/Client.h')
-rw-r--r--Userland/Services/WebServer/Client.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/Userland/Services/WebServer/Client.h b/Userland/Services/WebServer/Client.h
index 98ddfdc654..b817c35738 100644
--- a/Userland/Services/WebServer/Client.h
+++ b/Userland/Services/WebServer/Client.h
@@ -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();