From 013520b0c0df436c120b713deeeafa3f42d18955 Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Thu, 25 Nov 2021 12:29:45 +0000 Subject: [PATCH] Add note for mg_http_serve_dir() --- docs/README.md | 4 ++++ examples/http-server/main.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index 72c058e9..cc794b76 100644 --- a/docs/README.md +++ b/docs/README.md @@ -912,6 +912,10 @@ void mg_http_serve_dir(struct mg_connection *c, struct mg_http_message *hm, Serve static files according to the given options. Note that in order to enable SSI, set a `-DMG_ENABLE_SSI=1` build flag. +NOTE: Avoid double dots `..` in +the `root_dir`. If you need to +reference an upper-level directory, use absolute path. + Parameters: - `c` - Connection to use - `hm` - HTTP message, that should be served diff --git a/examples/http-server/main.c b/examples/http-server/main.c index 7b03f5e3..7c1d7d27 100644 --- a/examples/http-server/main.c +++ b/examples/http-server/main.c @@ -5,7 +5,7 @@ #include "mongoose.h" static const char *s_debug_level = "2"; -static const char *s_root_dir = "."; +static const char *s_root_dir = "."; // Attention: avoid double-dots, `..` ! static const char *s_listening_address = "http://localhost:8000"; static const char *s_enable_hexdump = "no";