@@ -465,8 +465,9 @@ class Server {
465
465
Server &Delete (const char *pattern, Handler handler);
466
466
Server &Options (const char *pattern, Handler handler);
467
467
468
- [[deprecated]] bool set_base_dir (const char *dir, const char *mount_point = nullptr );
469
- bool set_mount_point (const char *mount_point, const char * dir);
468
+ [[deprecated]] bool set_base_dir (const char *dir,
469
+ const char *mount_point = nullptr );
470
+ bool set_mount_point (const char *mount_point, const char *dir);
470
471
bool remove_mount_point (const char *mount_point);
471
472
void set_file_extension_and_mimetype_mapping (const char *ext,
472
473
const char *mime);
@@ -2891,10 +2892,10 @@ inline Server &Server::Options(const char *pattern, Handler handler) {
2891
2892
}
2892
2893
2893
2894
inline bool Server::set_base_dir (const char *dir, const char *mount_point) {
2894
- return set_mount_point (mount_point, dir);
2895
+ return set_mount_point (mount_point, dir);
2895
2896
}
2896
2897
2897
- inline bool Server::set_mount_point (const char *mount_point, const char * dir) {
2898
+ inline bool Server::set_mount_point (const char *mount_point, const char * dir) {
2898
2899
if (detail::is_dir (dir)) {
2899
2900
std::string mnt = mount_point ? mount_point : " /" ;
2900
2901
if (!mnt.empty () && mnt[0 ] == ' /' ) {
@@ -2907,10 +2908,10 @@ inline bool Server::set_mount_point(const char *mount_point, const char* dir) {
2907
2908
2908
2909
inline bool Server::remove_mount_point (const char *mount_point) {
2909
2910
for (auto it = base_dirs_.begin (); it != base_dirs_.end (); ++it) {
2910
- if (it->first == mount_point) {
2911
- base_dirs_.erase (it);
2912
- return true ;
2913
- }
2911
+ if (it->first == mount_point) {
2912
+ base_dirs_.erase (it);
2913
+ return true ;
2914
+ }
2914
2915
}
2915
2916
return false ;
2916
2917
}
@@ -3228,7 +3229,8 @@ inline bool Server::read_content_core(Stream &strm, bool last_connection,
3228
3229
return true ;
3229
3230
}
3230
3231
3231
- inline bool Server::handle_file_request (Request &req, Response &res, bool head) {
3232
+ inline bool Server::handle_file_request (Request &req, Response &res,
3233
+ bool head) {
3232
3234
for (const auto &kv : base_dirs_) {
3233
3235
const auto &mount_point = kv.first ;
3234
3236
const auto &base_dir = kv.second ;
@@ -3246,7 +3248,9 @@ inline bool Server::handle_file_request(Request &req, Response &res, bool head)
3246
3248
detail::find_content_type (path, file_extension_and_mimetype_map_);
3247
3249
if (type) { res.set_header (" Content-Type" , type); }
3248
3250
res.status = 200 ;
3249
- if (!head && file_request_handler_) { file_request_handler_ (req, res); }
3251
+ if (!head && file_request_handler_) {
3252
+ file_request_handler_ (req, res);
3253
+ }
3250
3254
return true ;
3251
3255
}
3252
3256
}
@@ -3348,7 +3352,10 @@ inline bool Server::routing(Request &req, Response &res, Stream &strm,
3348
3352
bool last_connection) {
3349
3353
// File handler
3350
3354
bool is_head_request = req.method == " HEAD" ;
3351
- if ((req.method == " GET" || is_head_request) && handle_file_request (req, res, is_head_request)) { return true ; }
3355
+ if ((req.method == " GET" || is_head_request) &&
3356
+ handle_file_request (req, res, is_head_request)) {
3357
+ return true ;
3358
+ }
3352
3359
3353
3360
if (detail::expect_content (req)) {
3354
3361
// Content reader handler
0 commit comments