no auto conversion to std::string()

pull/1/head
Volker Birk 3 years ago
parent 6e7748872e
commit 5d8fbbaec3
  1. 1
      .gitignore
  2. 6
      webserver.cc

1
.gitignore vendored

@ -56,3 +56,4 @@ tags
ws
test_webserver
local.conf

@ -109,11 +109,11 @@ void Webserver::deliver_file(tcp::socket *socket, const request& req)
std::string d{req.target().data(), req.target().length()};
if (boost::regex_match(d.c_str(), m, file)) {
fs::path p{_doc_root};
p /= m[1];
p /= std::string(m[1]);
beast::error_code ec;
http::file_body::value_type body;
body.open(p.c_str(), beast::file_mode::scan, ec);
body.open(p.string().c_str(), beast::file_mode::scan, ec);
if (ec == beast::errc::no_such_file_or_directory) {
deliver_status(socket, req, http::status::not_found);
}
@ -126,7 +126,7 @@ void Webserver::deliver_file(tcp::socket *socket, const request& req)
std::piecewise_construct,
std::make_tuple(std::move(body)),
std::make_tuple(http::status::ok, req.version())};
res.set(http::field::content_type, mime_type(p.c_str()));
res.set(http::field::content_type, mime_type(p.string().c_str()));
res.content_length(size);
res.keep_alive(req.keep_alive());
http::write(*socket, res, ec);

Loading…
Cancel
Save