Use field in basic_fields and call sites

This commit is contained in:
Vinnie Falco
2017-07-20 08:12:18 -07:00
parent d5f22adeca
commit ca25eee0dd
18 changed files with 220 additions and 69 deletions
+6 -6
View File
@@ -166,8 +166,8 @@ private:
response<string_body> res;
res.result(status::not_found);
res.version = req.version;
res.insert("Server", "http_sync_server");
res.insert("Content-Type", "text/html");
res.insert(field::server, "http_sync_server");
res.insert(field::content_type, "text/html");
res.body = "The file '" + path + "' was not found";
res.prepare();
write(sock, res, ec);
@@ -181,8 +181,8 @@ private:
res.result(status::ok);
res.reason("OK");
res.version = req.version;
res.insert("Server", "http_sync_server");
res.insert("Content-Type", mime_type(path));
res.insert(field::server, "http_sync_server");
res.insert(field::content_type, mime_type(path));
res.body = path;
res.prepare();
write(sock, res, ec);
@@ -195,8 +195,8 @@ private:
res.result(status::internal_server_error);
res.reason("Internal Error");
res.version = req.version;
res.insert("Server", "http_sync_server");
res.insert("Content-Type", "text/html");
res.insert(field::server, "http_sync_server");
res.insert(field::content_type, "text/html");
res.body =
std::string{"An internal error occurred: "} + e.what();
res.prepare();