37 imageFilter.
pathFilter({{
"test",
"static",
"images"},
38 {
"test2",
"static",
"images"}});
40 imageFilter.
basePath(
"/var/www/multipage/images");
45 blockNonImages.
pathFilter({{
"test",
"static",
"images"},
46 {
"test2",
"static",
"images"}});
49 blockNonImages.
status(404);
54 htmlFilter.
pathFilter({{
"test",
"static",
"html"}});
56 htmlFilter.
basePath(
"/var/www/multipage/html");
61 blockNonHtml.
pathFilter({{
"test",
"static",
"html"}});
70 {
"test2",
"static"}});
71 authFilter.
authName(
"Not for everyone!");
72 authFilter.
authFunction() = [](std::string user, std::string password) ->
bool {
73 return (user ==
"test" && password ==
"supersecure");
90 resp <<
"<!DOCTYPE html><html><head>"
91 "<title>nawa Multipage Example</title>"
92 "</head><body><p>Request Path Elements: ";
93 for (
auto const& e : requestPath) {
98 if (requestPath.size() > 1) {
101 if (requestPath.at(0) ==
"test" && requestPath.at(1) ==
"page1") {
102 resp <<
"<h1>First Page</h1>"
103 "<p>Lorem ipsum sit dolor</p>"
111 resp <<
"<h1>Index</h1>"
113 "<li><a href=\"/test/page1\">First Page</a></li>"
114 "<li><a href=\"/test/static/html/somedocument.html\">A static HTML document</a></li>"
115 "</ul></body></html>";
This file will be configured by CMake and contains the necessary properties to ensure that a loaded a...
std::vector< BlockFilter > & blockFilters() noexcept
bool & filtersEnabled() noexcept
std::vector< AuthFilter > & authFilters() noexcept
std::vector< ForwardFilter > & forwardFilters() noexcept
std::vector< std::string > & extensionFilter() noexcept
std::vector< std::vector< std::string > > & pathFilter() noexcept
bool & invertExtensionFilter() noexcept
AccessFilterList & accessFilters()
std::string & authName() noexcept
std::function< bool(std::string, std::string)> & authFunction() noexcept
unsigned int & status() noexcept
std::ostream & responseStream() noexcept
nawa::Request const & request() const noexcept
std::string & basePath() noexcept
request::Env const & env() const noexcept
std::vector< std::string > getRequestPath() const
int handleRequest(Connection &connection)
int init(AppInit &appInit)