12#ifndef HTTP_FILE_SERVER_H
13#define HTTP_FILE_SERVER_H
45 bool listDirectory(
const std::string& path, std::vector<FileInfo>& out);
96 std::string
getMimeType(
const std::string &filePath);
Defines the HttpRequest class for handling HTTP requests: headers, method, path, query string,...
HTTP HttpResponse class for managing status, headers, body, and streaming support.
Abstract interface for file and directory storage backends.
Helper class for accessing the file system and serving file content.
FileHandler()
Construct a new FileHandler object.
bool mounted
Flag indicating whether storage is mounted.
bool serveFile(HttpResponse &res, const char *uri)
Serve a file to the client via the HttpResponse object.
StorageManager * storageManager
bool listDirectory(const std::string &path, std::vector< FileInfo > &out)
Return a list of a given directory.
bool init()
Initialize and mount the storage (e.g., SD card).
HTTP-level controller for serving static files and directory listings.
std::string getMimeType(const std::string &filePath)
Get the MIME type based on the file extension.
void handle_list_directory(HttpRequest &req, HttpResponse &res, const RouteMatch &match)
Handle requests to list directory contents.
void handle_static_request(HttpRequest &req, HttpResponse &res, const RouteMatch &match)
Handle requests for static file content.
HttpFileserver()
Construct a new HttpFileserver object.
Forward declaration for potential routing needs.
Represents an HTTP response object.
Abstract base class for storage access and file operations.
Represents a match of a route against an incoming HTTP request.