Diff

net/httpserver.lua @ 697:8ddc85fa7602

core.httpserver: Rename request.responseheaders to the more logical request.headers
author Matthew Wild <mwild1@gmail.com>
date Mon, 12 Jan 2009 04:02:29 +0000
parent 634:1af93ea23f96
child 958:172fb9a73017
line wrap: on
line diff
--- a/net/httpserver.lua	Mon Jan 12 03:29:05 2009 +0000
+++ b/net/httpserver.lua	Mon Jan 12 04:02:29 2009 +0000
@@ -126,7 +126,7 @@
 	end
 	if request.state == "body" then
 		log("debug", "Reading body...")
-		if not request.body then request.body = {}; request.havebodylength, request.bodylength = 0, tonumber(request.responseheaders["content-length"]); end
+		if not request.body then request.body = {}; request.havebodylength, request.bodylength = 0, tonumber(request.headers["content-length"]); end
 		if startpos then
 			data = data:sub(startpos, -1)
 		end
@@ -141,7 +141,7 @@
 	elseif request.state == "headers" then
 		log("debug", "Reading headers...")
 		local pos = startpos;
-		local headers = request.responseheaders or {};
+		local headers = request.headers or {};
 		for line in data:gmatch("(.-)\r\n") do
 			startpos = (startpos or 1) + #line + 2;
 			local k, v = line:match("(%S+): (.+)");
@@ -149,7 +149,7 @@
 				headers[k:lower()] = v;
 --				log("debug", "Header: "..k:lower().." = "..v);
 			elseif #line == 0 then
-				request.responseheaders = headers;
+				request.headers = headers;
 				break;
 			else
 				log("debug", "Unhandled header line: "..line);