projects
/
prosody.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
prosody.cfg.lua.dist: Remove lie about requiring console_enabled
[prosody.git]
/
plugins
/
mod_httpserver.lua
diff --git
a/plugins/mod_httpserver.lua
b/plugins/mod_httpserver.lua
index 119ecadce6202fc18e6444fb6c8423f5f00fb956..1cdcc78788413fad6f3350d42b5f46b7a2394f58 100644
(file)
--- a/
plugins/mod_httpserver.lua
+++ b/
plugins/mod_httpserver.lua
@@
-23,7
+23,7
@@
local mime_map = {
htm = "text/html";
xml = "text/xml";
xsl = "text/xml";
htm = "text/html";
xml = "text/xml";
xsl = "text/xml";
- txt = "
plain/text
; charset=utf-8";
+ txt = "
text/plain
; charset=utf-8";
js = "text/javascript";
css = "text/css";
};
js = "text/javascript";
css = "text/css";
};
@@
-47,16
+47,12
@@
local function preprocess_path(path)
end
function serve_file(path)
end
function serve_file(path)
- local f, err = open(http_base..path, "r");
+ local f, err = open(http_base..path, "r
b
");
if not f then return response_404; end
local data = f:read("*a");
f:close();
local ext = path:match("%.([^.]*)$");
if not f then return response_404; end
local data = f:read("*a");
f:close();
local ext = path:match("%.([^.]*)$");
- local mime = mime_map[ext];
- if not mime then
- mime = ext and "application/octet-stream" or "text/html";
- end
- module:log("warn", "ext: %s, mime: %s", ext, mime);
+ local mime = mime_map[ext]; -- Content-Type should be nil when not known
return {
headers = { ["Content-Type"] = mime; };
body = data;
return {
headers = { ["Content-Type"] = mime; };
body = data;