integrate files with serving (even though ugly)

This commit is contained in:
= 2024-12-16 20:17:09 +01:00
parent 63fd2b7cca
commit 897310fe28
7 changed files with 83 additions and 36 deletions

View file

@ -4,14 +4,20 @@
#include <boost/beast/http.hpp>
#include <boost/beast/http/message.hpp>
#include <boost/beast/http/string_body.hpp>
#include <variant>
using namespace boost::beast;
class RequestHandler {
public:
http::response<http::string_body> handle(const http::request<http::string_body>& request);
std::variant<
http::response<http::string_body>,
http::response<http::file_body>
> handle(const http::request<http::string_body>& request);
private:
http::response<http::string_body> BadRequest(const std::string& why);
http::response<http::file_body> handle_file_request(const std::string& filename, boost::system::error_code& ec);
};
#endif