mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
fix check header limit
This commit is contained in:
@@ -48,9 +48,6 @@ function M.recvheader(readbytes, lines, header)
|
|||||||
while true do
|
while true do
|
||||||
local bytes = readbytes()
|
local bytes = readbytes()
|
||||||
header = header .. bytes
|
header = header .. bytes
|
||||||
if #header > LIMIT then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
e = header:find("\r\n\r\n", -#bytes-3, true)
|
e = header:find("\r\n\r\n", -#bytes-3, true)
|
||||||
if e then
|
if e then
|
||||||
result = header:sub(e+4)
|
result = header:sub(e+4)
|
||||||
@@ -59,6 +56,9 @@ function M.recvheader(readbytes, lines, header)
|
|||||||
if header:find "^\r\n" then
|
if header:find "^\r\n" then
|
||||||
return header:sub(3)
|
return header:sub(3)
|
||||||
end
|
end
|
||||||
|
if #header > LIMIT then
|
||||||
|
return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for v in header:gmatch("(.-)\r\n") do
|
for v in header:gmatch("(.-)\r\n") do
|
||||||
|
|||||||
Reference in New Issue
Block a user