Renamed field req.header -> req.headers

This commit is contained in:
rxi 2014-04-09 23:41:08 +01:00
parent 962019f0de
commit 9e2f65acff

View File

@ -153,15 +153,15 @@ function lovebird.onConnect(client)
req.addr, req.port = client:getsockname()
req.request = client:receive()
req.method, req.url, req.proto = req.request:match(requestptn)
req.header = {}
req.headers = {}
while 1 do
local line = client:receive()
if not line or #line == 0 then break end
local k, v = line:match("(.-):%s*(.*)$")
req.header[k] = v
req.headers[k] = v
end
if req.header["Content-Length"] then
req.body = client:receive(req.header["Content-Length"])
if req.headers["Content-Length"] then
req.body = client:receive(req.headers["Content-Length"])
end
-- Handle request; get data to send
local data, index = lovebird.onRequest(req), 0