From: Steven Barth Date: Fri, 22 Aug 2008 20:33:48 +0000 (+0000) Subject: libs/http: Fixed default sink for unknown data X-Git-Tag: 0.8.0~319 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=830ca24abba0ec45618c0121306461fc50c2b7bd;p=oweals%2Fluci.git libs/http: Fixed default sink for unknown data --- 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