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