diff options
author | Matthew Wild <mwild1@gmail.com> | 2010-01-21 13:10:13 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2010-01-21 13:10:13 +0000 |
commit | ab114b1b5f001020b8ee628c42c4f333c5bb32ef (patch) | |
tree | a89e1685b0cf9d71bd8de3c14093dc719d568d86 | |
parent | 566248821ca05cdfb0e9ec4aed392ced09d4d1bd (diff) | |
download | prosody-ab114b1b5f001020b8ee628c42c4f333c5bb32ef.tar.gz prosody-ab114b1b5f001020b8ee628c42c4f333c5bb32ef.zip |
net.httpserver: Close connection on invalid HTTP status line
-rw-r--r-- | net/httpserver.lua | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/net/httpserver.lua b/net/httpserver.lua index dec13a0b..40bcd9df 100644 --- a/net/httpserver.lua +++ b/net/httpserver.lua @@ -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; |