Comparison

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
comparison
equal deleted inserted replaced
3472:61cf3e7d7f07 3473:84fe4d5ac2ed
150 150
151 for line in data:gmatch("(.-)\r\n") do 151 for line in data:gmatch("(.-)\r\n") do
152 startpos = (startpos or 1) + #line + 2; 152 startpos = (startpos or 1) + #line + 2;
153 local k, v = line:match("(%S+): (.+)"); 153 local k, v = line:match("(%S+): (.+)");
154 if k and v then 154 if k and v then
155 headers[k:lower()] = v; 155 k = k:lower();
156 if headers[k] then
157 headers[k] = headers[k]..", "..v;
158 else
159 headers[k] = v;
160 end
156 --log("debug", "Header: '"..k:lower().."' = '"..v.."'"); 161 --log("debug", "Header: '"..k:lower().."' = '"..v.."'");
157 elseif #line == 0 then 162 elseif #line == 0 then
158 headers_complete = true; 163 headers_complete = true;
159 break; 164 break;
160 else 165 else