net.httpserver: Close connection on invalid HTTP status line
authorMatthew Wild <mwild1@gmail.com>
Thu, 21 Jan 2010 13:10:13 +0000 (13:10 +0000)
committerMatthew Wild <mwild1@gmail.com>
Thu, 21 Jan 2010 13:10:13 +0000 (13:10 +0000)
net/httpserver.lua

index dec13a0bafebc6df8f80e3e52780267e38ff137c..40bcd9df0155c84460e411e0c1b01baf581f83fb 100644 (file)
@@ -171,7 +171,10 @@ local function request_reader(request, data, startpos)
                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;