net.httpserver: Join multiple headers with the same name as per RFC (thanks darkhippo)

This commit is contained in:
Matthew Wild 2010-08-28 23:41:09 +01:00
parent be6148a1eb
commit fc62af2024

View file

@ -152,7 +152,12 @@ local function request_reader(request, data, startpos)
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;