summaryrefslogtreecommitdiff
path: root/http_static.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'http_static.cpp')
-rw-r--r--http_static.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/http_static.cpp b/http_static.cpp
index 7f56744..a0856f4 100644
--- a/http_static.cpp
+++ b/http_static.cpp
@@ -19,12 +19,8 @@ void HTTP::Static::operator()(Connection::p connection) {
}
if(fs::is_regular_file(path)) {
- fs::ifstream is(path, std::ios::in | std::ios::binary);
- is.seekg(0, std::ios::end);
- connection->add_header("content-length", boost::str(boost::format("%d") % is.tellg()));
- is.seekg(0, std::ios::beg);
-
- connection->send_data(is);
+ connection->send_file(path);
+
} else if(fs::exists(path)) {
connection->send_error(403);
} else {