mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
bugfix: chunked mode
This commit is contained in:
@@ -46,6 +46,11 @@ local http_status_msg = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
local function recvheader(readbytes, limit, lines, header)
|
local function recvheader(readbytes, limit, lines, header)
|
||||||
|
if #header >= 2 then
|
||||||
|
if header:find "^\r\n" then
|
||||||
|
return header:sub(3)
|
||||||
|
end
|
||||||
|
end
|
||||||
local result
|
local result
|
||||||
local e = header:find("\r\n\r\n", 1, true)
|
local e = header:find("\r\n\r\n", 1, true)
|
||||||
if e then
|
if e then
|
||||||
@@ -62,6 +67,9 @@ local function recvheader(readbytes, limit, lines, header)
|
|||||||
result = header:sub(e+4)
|
result = header:sub(e+4)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
if header:find "^\r\n" then
|
||||||
|
return header:sub(3)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for v in header:gmatch("(.-)\r\n") do
|
for v in header:gmatch("(.-)\r\n") do
|
||||||
@@ -156,10 +164,6 @@ local function recvchunkedbody(readbytes, bodylimit, header, body)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
body = readcrln(readbytes, body)
|
|
||||||
if not body then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local tmpline = {}
|
local tmpline = {}
|
||||||
body = recvheader(readbytes, 8192, tmpline, body)
|
body = recvheader(readbytes, 8192, tmpline, body)
|
||||||
if not body then
|
if not body then
|
||||||
@@ -194,7 +198,7 @@ local function readall(readbytes, bodylimit)
|
|||||||
end
|
end
|
||||||
local mode = header["transfer-encoding"]
|
local mode = header["transfer-encoding"]
|
||||||
if mode then
|
if mode then
|
||||||
if mode ~= "identity" or mode ~= "chunked" then
|
if mode ~= "identity" and mode ~= "chunked" then
|
||||||
return 501 -- Not Implemented
|
return 501 -- Not Implemented
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user