mod_httpserver: Skip returning a Content-Type when not known (application/octet-stream is not a correct default).

Thu, 10 Dec 2009 16:25:50 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Thu, 10 Dec 2009 16:25:50 +0500
changeset 2772
18d83fd07db1
parent 2771
c9834f338a4e
child 2773
591c8ae9ae09

mod_httpserver: Skip returning a Content-Type when not known (application/octet-stream is not a correct default).

plugins/mod_httpserver.lua file | annotate | diff | comparison | revisions
--- a/plugins/mod_httpserver.lua	Thu Dec 10 16:22:34 2009 +0500
+++ b/plugins/mod_httpserver.lua	Thu Dec 10 16:25:50 2009 +0500
@@ -52,11 +52,8 @@
 	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;

mercurial