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 8083501961171645094635cc46c0e49774ddf29d..2424759618bf4c7a9ffa8cc23763f58a5bec5deb 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;