From 830ca24abba0ec45618c0121306461fc50c2b7bd Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Fri, 22 Aug 2008 20:33:48 +0000 Subject: [PATCH] libs/http: Fixed default sink for unknown data --- libs/http/luasrc/http/protocol.lua | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/libs/http/luasrc/http/protocol.lua b/libs/http/luasrc/http/protocol.lua index 6e2ae29e3..c80380e97 100644 --- a/libs/http/luasrc/http/protocol.lua +++ b/libs/http/luasrc/http/protocol.lua @@ -638,16 +638,17 @@ function parse_message_body( src, msg, filecb ) msg.content = "" msg.content_length = 0 - sink = function( chunk ) - if ( msg.content_length + #chunk ) <= HTTP_MAX_CONTENT then - - msg.content = msg.content .. chunk - msg.content_length = msg.content_length + #chunk - - return true - else - return nil, "POST data exceeds maximum allowed length" + sink = function( chunk, err ) + if chunk then + if ( msg.content_length + #chunk ) <= HTTP_MAX_CONTENT then + msg.content = msg.content .. chunk + msg.content_length = msg.content_length + #chunk + return true + else + return nil, "POST data exceeds maximum allowed length" + end end + return true end end -- 2.11.0