* luci/libs: http.protocol: prevent oversized read blocks when reading from socket...
[project/luci.git] / libs / web / luasrc / http / protocol.lua
index b0074b9..970983d 100644 (file)
@@ -520,9 +520,9 @@ function _linereader( obj, bufsz )
        elseif type(obj) == "userdata" and ( type(obj.receive) == "function" or type(obj.read) == "function" ) then
 
                if type(obj.read) == "function" then
-                       __read = function() return obj:read( bufsz ) end
+                       __read = function() return obj:read( bufsz - #_buf ) end
                else
-                       __read = function() return obj:receive( bufsz ) end
+                       __read = function() return obj:receive( bufsz - #_buf ) end
                end
 
        -- object is a function