Changeset

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
parents 3472:61cf3e7d7f07
children 3474:730876bbe4e6
files net/httpserver.lua
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
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;