mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-24 20:21:49 +00:00
Remove MG_ENABLE_DIRLIST, add mg_http_serve_opts :: enable_dir_listing
This commit is contained in:
1 parent
789372c5b3
commit
a419e16f26
12 files changed
+47
-83
No files matched your search
+9
-27
@@ -325,10 +325,6 @@ extern "C" {
|
||||
#define MG_ENABLE_POSIX_FS 1
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_DIRLIST
|
||||
#define MG_ENABLE_DIRLIST 1
|
||||
#endif
|
||||
|
||||
#ifndef MG_OTA_ESP32_WDT_TIMEOUT_MS
|
||||
#define MG_OTA_ESP32_WDT_TIMEOUT_MS 10000U
|
||||
#endif
|
||||
@@ -436,10 +432,6 @@ static inline uint32_t mg_ota_esp32_state_set(uint32_t state) {
|
||||
#define MG_PATH_MAX 100
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_DIRLIST
|
||||
#define MG_ENABLE_DIRLIST 0
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_TCPIP
|
||||
#define MG_ENABLE_TCPIP 1 // Enable built-in TCP/IP stack
|
||||
#endif
|
||||
@@ -888,10 +880,6 @@ static inline int mg_mkdir(const char *path, mode_t mode) {
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifndef MG_ENABLE_DIRLIST
|
||||
#define MG_ENABLE_DIRLIST 1
|
||||
#endif
|
||||
|
||||
#ifndef MG_PATH_MAX
|
||||
#define MG_PATH_MAX FILENAME_MAX
|
||||
#endif
|
||||
@@ -1073,10 +1061,6 @@ typedef int socklen_t;
|
||||
#define S_ISDIR(x) (((x) &_S_IFMT) == _S_IFDIR)
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_DIRLIST
|
||||
#define MG_ENABLE_DIRLIST 1
|
||||
#endif
|
||||
|
||||
#ifndef SIGPIPE
|
||||
#define SIGPIPE 0
|
||||
#endif
|
||||
@@ -1361,10 +1345,6 @@ struct timeval {
|
||||
#define MG_ENABLE_WINSOCK 1
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_DIRLIST
|
||||
#define MG_ENABLE_DIRLIST MG_ENABLE_LFS
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_CUSTOM_RANDOM
|
||||
#define MG_ENABLE_CUSTOM_RANDOM 0
|
||||
#endif
|
||||
@@ -2685,8 +2665,9 @@ struct mg_http_serve_opts {
|
||||
const char *mime_types; // Additional MIME types: "ext1=type1,ext2=type2". NULL for defaults only
|
||||
const char *page404; // Path to a custom 404 page, e.g. "/404.html". NULL for built-in
|
||||
struct mg_fs *fs; // Filesystem to use. NULL defaults to POSIX
|
||||
bool allow_delete; // Allow to DELETE files
|
||||
bool allow_upload; // Allow to POST/PUT files
|
||||
bool enable_delete; // Allow to DELETE files
|
||||
bool enable_upload; // Allow to POST/PUT files
|
||||
bool enable_dir_listing; // Enable directory listing
|
||||
};
|
||||
|
||||
// A single part of a multipart/form-data body, filled by mg_http_next_multipart().
|
||||
@@ -2760,10 +2741,11 @@ struct mg_connection *mg_http_connect(struct mg_mgr *, const char *url,
|
||||
// mg_http_listen(), mg_http_serve_file(), mg_http_reply(), mg_match()
|
||||
// Notes:
|
||||
// Call from an MG_EV_HTTP_MSG handler. The uri in hm is mapped under
|
||||
// opts->root_dir. Directory listing depends on MG_ENABLE_DIRLIST; SSI uses
|
||||
// opts->ssi_pattern when configured. opts->allow_delete enables DELETE;
|
||||
// opts->allow_upload enables POST/PUT, writing the whole body to a file -
|
||||
// see mg_http_serve_upload() to also stream big uploads without buffering.
|
||||
// opts->root_dir. opts->enable_dir_listing enables directory listing; SSI
|
||||
// uses opts->ssi_pattern when configured. opts->enable_delete enables
|
||||
// DELETE; opts->enable_upload enables POST/PUT, writing the whole body to
|
||||
// a file - see mg_http_serve_upload() to also stream big uploads without
|
||||
// buffering.
|
||||
void mg_http_serve_dir(struct mg_connection *, struct mg_http_message *hm,
|
||||
const struct mg_http_serve_opts *);
|
||||
|
||||
@@ -2775,7 +2757,7 @@ void mg_http_serve_file(struct mg_connection *, struct mg_http_message *hm,
|
||||
// whole body. Optional companion to mg_http_serve_dir(): call this from
|
||||
// MG_EV_HTTP_HDRS with the same opts, and keep calling mg_http_serve_dir()
|
||||
// from MG_EV_HTTP_MSG as usual - it still handles uploads this function skips.
|
||||
// Does nothing unless opts->allow_upload is set, the method is POST or PUT,
|
||||
// Does nothing unless opts->enable_upload is set, the method is POST or PUT,
|
||||
// and Content-Length is known and big enough.
|
||||
void mg_http_serve_upload(struct mg_connection *, struct mg_http_message *hm,
|
||||
const struct mg_http_serve_opts *);
|
||||
|
||||
Reference in new issue
Block a user