Software /
code /
prosody
Comparison
plugins/mod_http_files.lua @ 7982:e30b0cbed472
Merge 0.10->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 16 Mar 2017 23:49:27 +0100 |
parent | 7978:01aa6344a556 |
child | 7985:6521a51bb718 |
comparison
equal
deleted
inserted
replaced
7974:547f000941cf | 7982:e30b0cbed472 |
---|---|
17 local path_sep = package.config:sub(1,1); | 17 local path_sep = package.config:sub(1,1); |
18 | 18 |
19 local base_path = module:get_option_string("http_files_dir", module:get_option_string("http_path")); | 19 local base_path = module:get_option_string("http_files_dir", module:get_option_string("http_path")); |
20 local cache_size = module:get_option_number("http_files_cache_size", 128); | 20 local cache_size = module:get_option_number("http_files_cache_size", 128); |
21 local cache_max_file_size = module:get_option_number("http_files_cache_max_file_size", 4096); | 21 local cache_max_file_size = module:get_option_number("http_files_cache_max_file_size", 4096); |
22 local dir_indices = module:get_option("http_index_files", { "index.html", "index.htm" }); | 22 local dir_indices = module:get_option_array("http_index_files", { "index.html", "index.htm" }); |
23 local directory_index = module:get_option_boolean("http_dir_listing"); | 23 local directory_index = module:get_option_boolean("http_dir_listing"); |
24 | 24 |
25 local mime_map = module:shared("/*/http_files/mime").types; | 25 local mime_map = module:shared("/*/http_files/mime").types; |
26 if not mime_map then | 26 if not mime_map then |
27 mime_map = { | 27 mime_map = { |
35 jpeg = "image/jpeg", jpg = "image/jpeg", | 35 jpeg = "image/jpeg", jpg = "image/jpeg", |
36 svg = "image/svg+xml", | 36 svg = "image/svg+xml", |
37 }; | 37 }; |
38 module:shared("/*/http_files/mime").types = mime_map; | 38 module:shared("/*/http_files/mime").types = mime_map; |
39 | 39 |
40 local mime_types, err = open(module:get_option_string("mime_types_file", "/etc/mime.types"),"r"); | 40 local mime_types, err = open(module:get_option_path("mime_types_file", "/etc/mime.types", prosody.paths.config), "r"); |
41 if mime_types then | 41 if mime_types then |
42 local mime_data = mime_types:read("*a"); | 42 local mime_data = mime_types:read("*a"); |
43 mime_types:close(); | 43 mime_types:close(); |
44 setmetatable(mime_map, { | 44 setmetatable(mime_map, { |
45 __index = function(t, ext) | 45 __index = function(t, ext) |