From 917d4574153fa57ea43e7410006f58aa5b1bbb0b Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sun, 5 Apr 2020 19:15:25 +0200 Subject: Separate out response handling --- response.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 response.h (limited to 'response.h') diff --git a/response.h b/response.h new file mode 100644 index 0000000..a093320 --- /dev/null +++ b/response.h @@ -0,0 +1,40 @@ +#pragma once + +#include "config.h" + +#include + +#include +#include + +namespace beast = boost::beast; // from +namespace http = beast::http; // from + +class http_exception: public std::exception +{ + std::string m_message; +public: + http_exception(std::string message); + virtual const char* what() const noexcept; +}; + +class bad_request_exception: public http_exception +{ +public: + bad_request_exception(std::string message); +}; + +class not_found_exception: public http_exception +{ +public: + not_found_exception(std::string message); +}; + +class server_error_exception: public http_exception +{ +public: + server_error_exception(std::string message); +}; + +std::string extend_index_html(std::string path); +std::string generate_response(http::request& req, const Config& config, const Socket& socket); -- cgit v1.2.3