mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-23 10:50:49 +00:00
WebServer: Allow the user to specify the base directory
This commit makes the WebServer accept a base path to serve. This makes taking files out of the system significantly more simple (depending on whom you ask).
This commit is contained in:
parent
7b5ffe67cf
commit
684b04e02a
Notes:
sideshowbarker
2024-07-19 04:58:12 +09:00
Author: https://github.com/alimpfard
Commit: 684b04e02a
Pull-request: https://github.com/SerenityOS/serenity/pull/2759
3 changed files with 20 additions and 6 deletions
|
@ -34,11 +34,12 @@ namespace WebServer {
|
|||
|
||||
class Client final : public Core::Object {
|
||||
C_OBJECT(Client);
|
||||
|
||||
public:
|
||||
void start();
|
||||
|
||||
private:
|
||||
Client(NonnullRefPtr<Core::TCPSocket>, Core::Object* parent);
|
||||
Client(NonnullRefPtr<Core::TCPSocket>, const String&, Core::Object* parent);
|
||||
|
||||
void handle_request(ByteBuffer);
|
||||
void send_response(StringView, const HTTP::HttpRequest&);
|
||||
|
@ -49,6 +50,7 @@ private:
|
|||
void handle_directory_listing(const String& requested_path, const String& real_path, const HTTP::HttpRequest&);
|
||||
|
||||
NonnullRefPtr<Core::TCPSocket> m_socket;
|
||||
String m_root_path;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue