Merge pull request #1924 from cesanta/scaprile-patch-1

Update README.md
This commit is contained in:
Sergio R. Caprile 2022-12-15 10:31:37 -03:00 committed by GitHub
commit 28c8519e5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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); const struct mg_http_serve_opts *opts);
``` ```
Serve static files according to the given options. Note that in order to 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)
enable SSI, set a `-DMG_ENABLE_SSI=1` build flag.
<span class="badge bg-warning">NOTE: </span> In order to enable SSI, you need to set the `-DMG_ENABLE_SSI=1` build flag.
<span class="badge bg-danger">NOTE: </span> Avoid double dots `..` in <span class="badge bg-danger">NOTE: </span> Avoid double dots `..` in
the `root_dir`. If you need to 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: Parameters:
- `c` - Connection to use - `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); 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
<span class="badge bg-danger">NOTE: </span> `opts->root_dir` settings <span class="badge bg-danger">NOTE: </span> `opts->root_dir` settings
is ignored by this function. is ignored by this function.