diff options
author | Ed Tanous <ed.tanous@intel.com> | 2018-03-28 03:41:04 +0300 |
---|---|---|
committer | Ed Tanous <ed.tanous@intel.com> | 2018-06-29 21:18:14 +0300 |
commit | e0d918bc397350aa21af3dab9faa6e21748f6373 (patch) | |
tree | bdc13d1e9937c0f153e89f3ab1be050d4bf52ee7 /include/webassets.hpp | |
parent | 77dd8813e9a1f2baec63d959de15af39a8cd12d0 (diff) | |
download | bmcweb-e0d918bc397350aa21af3dab9faa6e21748f6373.tar.xz |
Boost beast
This commit is the beginings of attempting to transition away from
crow, and toward boost::beast. Unit tests are passing, and
implementation appears to be slightly faster than crow.
Change-Id: Ic8d946dc7a04f514c67b1098f181eee1ced69171
Diffstat (limited to 'include/webassets.hpp')
-rw-r--r-- | include/webassets.hpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/include/webassets.hpp b/include/webassets.hpp index 6384f3abc3..85de3addf4 100644 --- a/include/webassets.hpp +++ b/include/webassets.hpp @@ -4,7 +4,6 @@ #include <fstream> #include <string> #include <crow/app.h> -#include <crow/http_codes.h> #include <crow/http_request.h> #include <crow/http_response.h> #include <crow/routing.h> @@ -88,7 +87,7 @@ void request_routes(Crow<Middlewares...>& app) { auto content_type_it = content_types.find(extension.c_str()); if (content_type_it == content_types.end()) { - CROW_LOG_ERROR << "Cannot determine content-type for " << webpath + CROW_LOG_ERROR << "Cannot determine content-type for " << absolute_path << " with extension " << extension; } else { content_type = content_type_it->second; @@ -109,13 +108,12 @@ void request_routes(Crow<Middlewares...>& app) { std::ifstream inf(absolute_path); if (!inf) { CROW_LOG_DEBUG << "failed to read file"; - res.code = static_cast<int>(HttpRespCode::NOT_FOUND); - res.code = static_cast<int>(HttpRespCode::INTERNAL_ERROR); + res.result(boost::beast::http::status::internal_server_error); res.end(); return; } - res.body = {std::istreambuf_iterator<char>(inf), + res.body() = {std::istreambuf_iterator<char>(inf), std::istreambuf_iterator<char>()}; res.end(); }); |