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 2357
d978e2ae7013
parent 2356
6d1e745a96f8
child 2358
e05934a5c911

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