mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-25 12:04:47 +00:00
Add enable_dirlist to mg_http_serve_opts
This commit is contained in:
1 parent
824e33ef8a
commit
8fc94e12af
7 files changed
+41
-13
No files matched your search
+5
-1
@@ -868,7 +868,11 @@ void mg_http_serve_dir(struct mg_connection *c, struct mg_http_message *hm,
|
||||
#endif
|
||||
if (is_index && fp == NULL) {
|
||||
#if MG_ENABLE_DIRECTORY_LISTING
|
||||
listdir(c, hm, opts, t2);
|
||||
if (opts->enable_dirlist && strcmp(opts->enable_dirlist, "no") == 0) {
|
||||
mg_http_reply(c, 403, "", "%s", "Denied");
|
||||
} else {
|
||||
listdir(c, hm, opts, t2);
|
||||
}
|
||||
#else
|
||||
mg_http_reply(c, 403, "", "%s", "Directory listing not supported");
|
||||
#endif
|
||||
|
||||
+4
-3
@@ -23,9 +23,10 @@ struct mg_http_message {
|
||||
|
||||
// Parameter for mg_http_serve_dir()
|
||||
struct mg_http_serve_opts {
|
||||
const char *root_dir; // Web root directory, must be non-NULL
|
||||
const char *ssi_pattern; // SSI file name pattern, e.g. #.shtml
|
||||
const char *extra_headers; // Extra HTTP headers to add in responses
|
||||
const char *root_dir; // Web root directory, must be non-NULL
|
||||
const char *ssi_pattern; // SSI file name pattern, e.g. #.shtml
|
||||
const char *extra_headers; // Extra HTTP headers to add in responses
|
||||
const char *enable_dirlist; // Enable dir listing. Set to "no" to disable
|
||||
};
|
||||
|
||||
// Parameter for mg_http_next_multipart
|
||||
|
||||
Reference in new issue
Block a user