# HG changeset patch # User Kim Alvefur # Date 1472223473 -7200 # Node ID 7674cb520557c40a04a1537d4d14273b2cb81e04 # Parent 9ddc9401911f64c3c703b4c2776fc234ec92924c# Parent 6879a220917b9af4fb84b210434f74c85d8235f5 Merge 0.10->trunk diff -r 9ddc9401911f -r 7674cb520557 net/http/parser.lua --- a/net/http/parser.lua Wed Aug 24 15:58:16 2016 +0200 +++ b/net/http/parser.lua Fri Aug 26 16:57:53 2016 +0200 @@ -134,6 +134,9 @@ if state then -- read body if client then if chunked then + if chunk_start and buflen - chunk_start - 2 < chunk_size then + return; + end -- not enough data if buftable then buf, buftable = t_concat(buf), false; end if not buf:find("\r\n", nil, true) then return; @@ -150,6 +153,7 @@ elseif buflen - chunk_start - 2 >= chunk_size then -- we have a chunk packet.body = packet.body..buf:sub(chunk_start, chunk_start + (chunk_size-1)); buf = buf:sub(chunk_start + chunk_size + 2); + buflen = buflen - (chunk_start + chunk_size + 2 - 1); chunk_size, chunk_start = nil, nil; else -- Partial chunk remaining break;