projects
/
prosody.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
56d47aa
)
net.http.parser: Fix chunked encoding parsing across packet boundaries.
author
daurnimator
<quae@daurnimator.com>
Mon, 10 Nov 2014 19:47:33 +0000
(14:47 -0500)
committer
daurnimator
<quae@daurnimator.com>
Mon, 10 Nov 2014 19:47:33 +0000
(14:47 -0500)
net/http/parser.lua
patch
|
blob
|
history
diff --git
a/net/http/parser.lua
b/net/http/parser.lua
index d896dff4c6749b589b8e0947b52e08c4d2b03c06..056d4b6029081cea9288aa82da6fea0da612319f 100644
(file)
--- a/
net/http/parser.lua
+++ b/
net/http/parser.lua
@@
-132,7
+132,7
@@
function httpstream.new(success_cb, error_cb, parser_type, options_cb)
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;