# HG changeset patch # User daurnimator # Date 1415648853 18000 # Node ID 46cf369d3eb56d496b7d4e2612bc303a8abf7a23 # Parent 7cb69eba3e95ef9182397d0a263bc81a31205c0a net.http.parser: Fix chunked encoding parsing across packet boundaries. diff -r 7cb69eba3e95 -r 46cf369d3eb5 net/http/parser.lua --- a/net/http/parser.lua Thu Oct 30 12:28:07 2014 +0100 +++ b/net/http/parser.lua Mon Nov 10 14:47:33 2014 -0500 @@ -132,7 +132,7 @@ state, chunk_size = nil, nil; buf = buf:gsub("^.-\r\n\r\n", ""); -- This ensure extensions and trailers are stripped success_cb(packet); - elseif #buf - chunk_start + 2 >= chunk_size then -- we have a chunk + elseif #buf - 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); chunk_size, chunk_start = nil, nil;