fix check header limit

This commit is contained in:
zixun
2019-03-28 16:53:46 +08:00
committed by 云风
parent ee1f5055ea
commit ea0cc1fade

View File

@@ -48,9 +48,6 @@ function M.recvheader(readbytes, lines, header)
while true do
local bytes = readbytes()
header = header .. bytes
if #header > LIMIT then
return
end
e = header:find("\r\n\r\n", -#bytes-3, true)
if e then
result = header:sub(e+4)
@@ -59,6 +56,9 @@ function M.recvheader(readbytes, lines, header)
if header:find "^\r\n" then
return header:sub(3)
end
if #header > LIMIT then
return
end
end
end
for v in header:gmatch("(.-)\r\n") do