Refactor the examples to compile with a C++11 compiler

This commit is contained in:
Duncan Ogilvie 2018-08-17 11:49:42 +02:00
parent 48b47ef209
commit 4af5b1e441
3 changed files with 12 additions and 13 deletions

View file

@ -105,7 +105,7 @@ int main(int argc, const char** argv)
Server svr;
#endif
svr.Post("/multipart", [](const auto& req, auto& res) {
svr.Post("/multipart", [](const Request& req, Response& res) {
auto body =
dump_headers(req.headers) +
dump_multipart_files(req.files);
@ -113,14 +113,14 @@ int main(int argc, const char** argv)
res.set_content(body, "text/plain");
});
svr.set_error_handler([](const auto& /*req*/, auto& res) {
svr.set_error_handler([](const Request& /*req*/, Response& res) {
const char* fmt = "<p>Error Status: <span style='color:red;'>%d</span></p>";
char buf[BUFSIZ];
snprintf(buf, sizeof(buf), fmt, res.status);
res.set_content(buf, "text/html");
});
svr.set_logger([](const auto& req, const auto& res) {
svr.set_logger([](const Request& req, const Response& res) {
cout << log(req, res);
});