mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 12:43:09 +00:00
check new stream after finding cr
This commit is contained in:
@@ -4,14 +4,15 @@ local LIMIT = 8192
|
|||||||
|
|
||||||
local function chunksize(readbytes, body)
|
local function chunksize(readbytes, body)
|
||||||
while true do
|
while true do
|
||||||
if #body > 128 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
body = body .. readbytes()
|
|
||||||
local f,e = body:find("\r\n",1,true)
|
local f,e = body:find("\r\n",1,true)
|
||||||
if f then
|
if f then
|
||||||
return tonumber(body:sub(1,f-1),16), body:sub(e+1)
|
return tonumber(body:sub(1,f-1),16), body:sub(e+1)
|
||||||
end
|
end
|
||||||
|
if #body > 128 then
|
||||||
|
-- pervent the attacker send very long stream without \r\n
|
||||||
|
return
|
||||||
|
end
|
||||||
|
body = body .. readbytes()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user