Diff

net/httpserver.lua @ 2360:f1832bf27f84

net.httpserver: Removed mime handling (now in mod_httpserver). Unknown dynamic content is now always served as text/html.
author Waqas Hussain <waqas20@gmail.com>
date Thu, 10 Dec 2009 16:36:33 +0500
parent 2321:7e7484a4e821
child 2371:7ddb8ce0cd0b
line wrap: on
line diff
--- 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");