25 lines
723 B
C++
25 lines
723 B
C++
#pragma once
|
|||
|
|
|
||
|
|
// Static file serving from disk or from embedded C++ assets, with path
|
||
|
|
// traversal protection, ETags, and cache-control headers.
|
||
|
|
// Gap: real static serving in 01-runtime.md owns ranges, conditional
|
||
|
|
// requests, and directory indexing; the embedder CLI lives in 09-cli-ops.md.
|
||
|
|
|
||
|
|
#include <map>
|
||
|
|
#include <string>
|
||
|
|
|
||
|
|
#include "Http.hpp"
|
||
|
|
|
||
|
|
namespace molo::example::fw {
|
||
|
|
|
||
|
|
bool path_is_safe(const std::string& request_path);
|
||
|
|
|
||
|
|
Response serve_disk_file(const std::string& root, const std::string& subpath);
|
||
|
|
|
||
|
|
Response serve_embedded(const std::map<std::string, std::string>& assets,
|
||
|
|
const std::string& subpath);
|
||
|
|
|
||
|
|
std::string etag_for(const std::string& body);
|
||
|
|
|
||
|
|
} // namespace molo::example::fw
|