net/http/files.lua
branch0.12
changeset 13449 360e05f33835
parent 11662 36942fa001b4
child 13450 dba7073f1452
equal deleted inserted replaced
13412:d7857ef7843a 13449:360e05f33835
    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);