From cfcb7191ea324dfa734325ab618fdacaaefc5f11 Mon Sep 17 00:00:00 2001 From: "Sergio R. Caprile" Date: Thu, 15 Dec 2022 09:52:19 -0300 Subject: [PATCH] Update README.md --- docs/README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/README.md b/docs/README.md index aa473e06..130456bb 100644 --- a/docs/README.md +++ b/docs/README.md @@ -986,12 +986,13 @@ void mg_http_serve_dir(struct mg_connection *c, struct mg_http_message *hm, const struct mg_http_serve_opts *opts); ``` -Serve static files according to the given options. Note that in order to -enable SSI, set a `-DMG_ENABLE_SSI=1` build flag. +Serve static files according to the given options. Files can also be gzip compressed, including the directory index. All compressed files must end in `.gz` and there must not exist a file with the same name without the extension, otherwise it will take precedence; see [mg_http_serve_file()](#mg_http_serve_file) + +NOTE: In order to enable SSI, you need to set the `-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. +reference an upper-level directory, use an absolute path. Parameters: - `c` - Connection to use @@ -1023,7 +1024,7 @@ void mg_http_serve_file(struct mg_connection *c, struct mg_http_message *hm, const char *path, struct mg_http_serve_opts *opts); ``` -Serve static file. +Serve a static file. If a file with the filename specified in `path` does not exist, Mongoose tries appending `.gz`; and if such a file exists, it will serve it with a `Content-Encoding: gzip` header NOTE: `opts->root_dir` settings is ignored by this function.