aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-02-19 03:21:50 +0000
committerMatthew Wild <mwild1@gmail.com>2010-02-19 03:21:50 +0000
commitead6371721b1d64f5dc7e3446222e002b3c2ced6 (patch)
tree543b646c10555e85cca5a082b9ffeb977bb9af15
parent79382a23050436d490bfd030ca2cc200f371bd2b (diff)
downloadprosody-ead6371721b1d64f5dc7e3446222e002b3c2ced6.tar.gz
prosody-ead6371721b1d64f5dc7e3446222e002b3c2ced6.zip
net.http: Close connection when invalid status line is received from the server
-rw-r--r--net/http.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/http.lua b/net/http.lua
index b533caae..bd08bdad 100644
--- a/net/http.lua
+++ b/net/http.lua
@@ -107,7 +107,10 @@ local function request_reader(request, data, startpos)
local http, code, text, linelen = data:match("^HTTP/(%S+) (%d+) (.-)\r\n()", startpos);
code = tonumber(code);
if not code then
- return request.callback("invalid-status-line", 0, request);
+ log("warn", "Invalid HTTP status line, telling callback then closing");
+ local ret = request.callback("invalid-status-line", 0, request);
+ destroy_request(request);
+ return ret;
end
request.code, request.responseversion = code, http;