Add server content data and mountableserver

This commit is contained in:
2025-01-12 19:32:19 -06:00
parent c80a5c503a
commit 4ce3526047
11 changed files with 265 additions and 19 deletions

View File

@ -0,0 +1,25 @@
#pragma once
#include "HttpServer.hpp"
#include "../Filesystem/VFSFix.hpp"
#include "../Filesystem/VFS.hpp"
namespace Tesses::Framework::Http
{
class MountableServer : public IHttpServer
{
IHttpServer* root;
bool owns;
std::vector<std::pair<std::string,std::pair<bool,IHttpServer*>>> servers;
std::string Subpath(Filesystem::VFSPath fullPath, Filesystem::VFSPath offsetPath);
bool StartsWith(Filesystem::VFSPath fullPath, Filesystem::VFSPath offsetPath);
public:
MountableServer();
MountableServer(IHttpServer* root, bool owns);
MountableServer(IHttpServer& root);
void Mount(std::string path, IHttpServer* server, bool owns);
void Mount(std::string path, IHttpServer& server);
void Unmount(std::string path);
bool Handle(ServerContext& ctx);
~MountableServer();
};
}