1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:08:10 +00:00

WebServer: Try to send an appopriate Content-Type header

Use Core::guess_mime_type_based_on_filename() for this. It's obviously
not perfect, but it works better than just sending "text/html" for
everything no matter what. :^)
This commit is contained in:
Andreas Kling 2020-07-27 19:50:24 +02:00
parent 78518d230c
commit 7f70a6f0cb
2 changed files with 9 additions and 6 deletions

View file

@ -42,7 +42,7 @@ private:
Client(NonnullRefPtr<Core::TCPSocket>, const String&, Core::Object* parent);
void handle_request(ByteBuffer);
void send_response(StringView, const HTTP::HttpRequest&);
void send_response(StringView, const HTTP::HttpRequest&, const String& content_type);
void send_redirect(StringView redirect, const HTTP::HttpRequest& request);
void send_error_response(unsigned code, const StringView& message, const HTTP::HttpRequest&);
void die();