net.httpserver: Removed mime handling (now in mod_httpserver). Unknown dynamic content is now always served as text/html.
authorWaqas Hussain <waqas20@gmail.com>
Thu, 10 Dec 2009 16:36:33 +0500
changeset 2775 72b31799b0cb
parent 2774 55ec6991c1a8
child 2776 bdca5025fb46
net.httpserver: Removed mime handling (now in mod_httpserver). Unknown dynamic content is now always served as text/html.
net/httpserver.lua
--- a/net/httpserver.lua	Thu Dec 10 16:34:38 2009 +0500
+++ b/net/httpserver.lua	Thu Dec 10 16:36:33 2009 +0500
@@ -23,9 +23,6 @@
 
 local log = require "util.logger".init("httpserver");
 
--- TODO: Should we read this from /etc/mime.types if it exists? (startup time...?)
-local mime_map = { html = "text/html", txt = "plain/text; charset=utf-8", js = "text/javascript" };
-
 local http_servers = {};
 
 module "httpserver"
@@ -68,9 +65,7 @@
 		
 		resp = { "HTTP/1.0 200 OK\r\n" };
 		t_insert(resp, "Connection: close\r\n");
-		t_insert(resp, "Content-Type: ");
-		t_insert(resp, mime_map[request.url.path:match("%.(%w+)")] or "application/octet-stream");
-		t_insert(resp, "\r\n");
+		t_insert(resp, "Content-Type: text/html\r\n");
 		t_insert(resp, "Content-Length: ");
 		t_insert(resp, #response);
 		t_insert(resp, "\r\n\r\n");