# HG changeset patch
# User Matthew Wild <mwild1@gmail.com>
# Date 1264079413 0
# Node ID ff5039708b191f836dec6d61d97e59989dd4b6c7
# Parent  f5cd7ee409ebe3ece700fa924625ce7c4c05dccf
net.httpserver: Close connection on invalid HTTP status line

diff -r f5cd7ee409eb -r ff5039708b19 net/httpserver.lua
--- a/net/httpserver.lua	Mon Jan 18 17:14:41 2010 +0000
+++ b/net/httpserver.lua	Thu Jan 21 13:10:13 2010 +0000
@@ -175,7 +175,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;