mod_httpserver: Skip returning a Content-Type when not known (application/octet-strea...
authorWaqas Hussain <waqas20@gmail.com>
Thu, 10 Dec 2009 11:25:50 +0000 (16:25 +0500)
committerWaqas Hussain <waqas20@gmail.com>
Thu, 10 Dec 2009 11:25:50 +0000 (16:25 +0500)
plugins/mod_httpserver.lua

index 119ecadce6202fc18e6444fb6c8423f5f00fb956..08328a43069328a936d1ed1498768ebcd5e3362f 100644 (file)
@@ -52,11 +52,8 @@ function serve_file(path)
        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
+       module:log("warn", "ext: %s, mime: %s", ext or "(nil)", mime or "(nil)");
        return {
                headers = { ["Content-Type"] = mime; };
                body = data;