diff options
author | Vegard Storheil Eriksen <zyp@jvnv.net> | 2011-01-10 13:02:25 +0100 |
---|---|---|
committer | Vegard Storheil Eriksen <zyp@jvnv.net> | 2011-01-10 13:02:25 +0100 |
commit | 65e25154a92ea47384bc540c129288ca9dad96cb (patch) | |
tree | 34cb02de4f6e8dc6066e747089564845bcfb1e4e /http_static.h | |
parent | fcaf8ace27d3421a45df7842a8275ebe35a5dbe3 (diff) |
Added HTTP::Static for serving static content.
Diffstat (limited to 'http_static.h')
-rw-r--r-- | http_static.h | 26 |
1 files changed, 26 insertions, 0 deletions
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 <boost/filesystem.hpp> + +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 |