net.httpserver: Close connection on invalid HTTP status line
authorMatthew Wild <mwild1@gmail.com>
Thu, 21 Jan 2010 13:10:13 +0000
changeset 2480 3596d181cfc3
parent 2479 9c074ba1f662
child 2481 9b407a6acf39
net.httpserver: Close connection on invalid HTTP status line
net/httpserver.lua
--- a/net/httpserver.lua	Thu Jan 21 12:57:12 2010 +0000
+++ b/net/httpserver.lua	Thu Jan 21 13:10:13 2010 +0000
@@ -171,7 +171,10 @@
 		log("debug", "Reading request line...")
 		local method, path, http, linelen = data:match("^(%S+) (%S+) HTTP/(%S+)\r\n()", startpos);
 		if not method then
-			return call_callback(request, "invalid-status-line");
+			log("warn", "Invalid HTTP status line, telling callback then closing");
+			local ret = call_callback(request, "invalid-status-line");
+			request:destroy();
+			return ret;
 		end
 		
 		request.method, request.path, request.httpversion = method, path, http;