Software /
code /
prosody
Diff
net/http/parser.lua @ 6522:46cf369d3eb5
net.http.parser: Fix chunked encoding parsing across packet boundaries.
author | daurnimator <quae@daurnimator.com> |
---|---|
date | Mon, 10 Nov 2014 14:47:33 -0500 |
parent | 6386:f942cf2a9a03 |
child | 6523:63d3126b75f1 |
line wrap: on
line diff
--- 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;