mirror of
https://github.com/rxi/lovebird.git
synced 2024-11-27 12:04:21 +00:00
Renamed field req.header -> req.headers
This commit is contained in:
parent
962019f0de
commit
9e2f65acff
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user