From 65e25154a92ea47384bc540c129288ca9dad96cb Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Mon, 10 Jan 2011 13:02:25 +0100 Subject: Added HTTP::Static for serving static content. --- http_static.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 http_static.h (limited to 'http_static.h') diff --git a/http_static.h b/http_static.h new file mode 100644 index 0000000..f8d2bec --- /dev/null +++ b/http_static.h @@ -0,0 +1,26 @@ +#ifndef HTTP_STATIC_H +#define HTTP_STATIC_H + +#include "http_connection.h" + +#include + +namespace fs = boost::filesystem; + +namespace HTTP { + //! HTTP Handler serving static files from a directory. + class Static { + private: + fs::path directory_; + std::string index_; + + public: + //! Construct Static-handler. + Static(fs::path directory, std::string index = "index.html"); + + //! Handle request. + void operator()(Connection::p connection); + }; +}; + +#endif -- cgit v1.2.3