aboutsummaryrefslogtreecommitdiffstats
path: root/net
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
commit463a83ee3fdf733f3d726874c8671f3f17a19ea0 (patch)
tree783c1b1f48d0c5011bcebfdad5cc06bcdd63e6f1 /net
parent7148417dbb8ead54ab628d20da2ce70edd6dfb98 (diff)
downloadprosody-463a83ee3fdf733f3d726874c8671f3f17a19ea0.tar.gz
prosody-463a83ee3fdf733f3d726874c8671f3f17a19ea0.zip
net.http: Close connection when invalid status line is received from the server
Diffstat (limited to 'net')
-rw-r--r--net/http.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/http.lua b/net/http.lua
index 863efc6c..b03b357c 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;