Browse Source

no auto conversion to std::string()

tags/Release_2.1.0-RC3
Volker Birk 3 months ago
parent
commit
5d8fbbaec3
2 changed files with 4 additions and 3 deletions
  1. +1
    -0
      .gitignore
  2. +3
    -3
      webserver.cc

+ 1
- 0
.gitignore View File

@@ -56,3 +56,4 @@ tags
ws

test_webserver
local.conf

+ 3
- 3
webserver.cc View File

@@ -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