Mercurial > prosody-hg
comparison net/http/files.lua @ 13446:dba7073f1452
Merge 0.12->trunk
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Tue, 27 Feb 2024 17:15:36 +0100 |
| parents | ba409c67353b 360e05f33835 |
| children | 14b52f217f7a |
comparison
equal
deleted
inserted
replaced
| 13444:783706350faa | 13446:dba7073f1452 |
|---|---|
| 56 end | 56 end |
| 57 local mime_map = opts.mime_map or { html = "text/html" }; | 57 local mime_map = opts.mime_map or { html = "text/html" }; |
| 58 local cache = new_cache(opts.cache_size or 256); | 58 local cache = new_cache(opts.cache_size or 256); |
| 59 local cache_max_file_size = tonumber(opts.cache_max_file_size) or 1024 | 59 local cache_max_file_size = tonumber(opts.cache_max_file_size) or 1024 |
| 60 -- luacheck: ignore 431 | 60 -- luacheck: ignore 431 |
| 61 local base_path = opts.path; | 61 local base_path = assert(opts.path, "invalid argument to net.http.files.path(), missing required 'path'"); |
| 62 local dir_indices = opts.index_files or { "index.html", "index.htm" }; | 62 local dir_indices = opts.index_files or { "index.html", "index.htm" }; |
| 63 local directory_index = opts.directory_index; | 63 local directory_index = opts.directory_index; |
| 64 local function serve_file(event, path) | 64 local function serve_file(event, path) |
| 65 local request, response = event.request, event.response; | 65 local request, response = event.request, event.response; |
| 66 local sanitized_path = sanitize_path(path); | 66 local sanitized_path = sanitize_path(path); |
