Changeset

2672:215d448d69d0

net.http: Close connection when invalid status line is received from the server
author Matthew Wild <mwild1@gmail.com>
date Fri, 19 Feb 2010 03:21:50 +0000
parents 2671:2dd69e1f7055
children 2673:61ae351c19b5
files net/http.lua
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/net/http.lua	Fri Feb 19 03:21:20 2010 +0000
+++ b/net/http.lua	Fri Feb 19 03:21:50 2010 +0000
@@ -107,7 +107,10 @@
 		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;