Changeset

2809:1a7b5b775275

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 2808:23bb7e29819e
children 2810:85e253d6c4cf
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;