Diff

net/httpserver.lua @ 3473:84fe4d5ac2ed

net.httpserver: Join multiple headers with the same name as per RFC (thanks darkhippo)
author Matthew Wild <mwild1@gmail.com>
date Sat, 28 Aug 2010 23:41:09 +0100
parent 2925:692b3c6c5bd2
child 3497:e9159b325e33
line wrap: on
line diff
--- a/net/httpserver.lua	Sat Aug 28 22:25:12 2010 +0100
+++ b/net/httpserver.lua	Sat Aug 28 23:41:09 2010 +0100
@@ -152,7 +152,12 @@
 			startpos = (startpos or 1) + #line + 2;
 			local k, v = line:match("(%S+): (.+)");
 			if k and v then
-				headers[k:lower()] = v;
+				k = k:lower();
+				if headers[k] then
+					headers[k] = headers[k]..", "..v;
+				else
+					headers[k] = v;
+				end
 				--log("debug", "Header: '"..k:lower().."' = '"..v.."'");
 			elseif #line == 0 then
 				headers_complete = true;