Fixed typo.
This commit is contained in:
parent
d999941a78
commit
5873e360a6
@ -406,7 +406,7 @@ inline void read_file(const std::string& path, std::string& out)
|
|||||||
fs.read(&out[0], size);
|
fs.read(&out[0], size);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::string get_file_extention(const std::string& path)
|
inline std::string get_file_extension(const std::string& path)
|
||||||
{
|
{
|
||||||
std::smatch m;
|
std::smatch m;
|
||||||
auto pat = std::regex("\\.([a-zA-Z0-9]+)$");
|
auto pat = std::regex("\\.([a-zA-Z0-9]+)$");
|
||||||
@ -418,7 +418,7 @@ inline std::string get_file_extention(const std::string& path)
|
|||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const char* get_content_type_from_file_extention(const std::string& ext)
|
inline const char* get_content_type_from_file_extension(const std::string& ext)
|
||||||
{
|
{
|
||||||
if (ext == "html") {
|
if (ext == "html") {
|
||||||
return "text/html";
|
return "text/html";
|
||||||
@ -896,8 +896,8 @@ inline bool Server::handle_file_request(Request& req, Response& res)
|
|||||||
if (detail::is_file(path)) {
|
if (detail::is_file(path)) {
|
||||||
detail::read_file(path, res.body);
|
detail::read_file(path, res.body);
|
||||||
res.set_header("Content-Type",
|
res.set_header("Content-Type",
|
||||||
detail::get_content_type_from_file_extention(
|
detail::get_content_type_from_file_extension(
|
||||||
detail::get_file_extention(path)));
|
detail::get_file_extension(path)));
|
||||||
res.status = 200;
|
res.status = 200;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user