From ea0cc1fadecaa538dabaae45ec31427fabffb827 Mon Sep 17 00:00:00 2001 From: zixun Date: Thu, 28 Mar 2019 16:53:46 +0800 Subject: [PATCH] fix check header limit --- lualib/http/internal.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lualib/http/internal.lua b/lualib/http/internal.lua index 5bb35752..6f76b86d 100644 --- a/lualib/http/internal.lua +++ b/lualib/http/internal.lua @@ -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