prosody.cfg.lua.dist: Remove lie about requiring console_enabled
[prosody.git] / plugins / mod_httpserver.lua
index 119ecadce6202fc18e6444fb6c8423f5f00fb956..1cdcc78788413fad6f3350d42b5f46b7a2394f58 100644 (file)
@@ -23,7 +23,7 @@ local mime_map = {
        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";
 };
@@ -47,16 +47,12 @@ local function preprocess_path(path)
 end
 
 function serve_file(path)
-       local f, err = open(http_base..path, "r");
+       local f, err = open(http_base..path, "rb");
        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;