* luci/libs: fix eof handling for urldecode_message_body() in protocol.lua
This commit is contained in:
parent
4f630d647c
commit
a9a80a3be3
1 changed files with 6 additions and 5 deletions
|
@ -500,8 +500,7 @@ process_states['urldecode-value'] = function( msg, chunk, filecb )
|
||||||
-- We're somewhere within a data section and our buffer is full
|
-- We're somewhere within a data section and our buffer is full
|
||||||
if #buffer > #chunk then
|
if #buffer > #chunk then
|
||||||
-- Flush buffered data
|
-- Flush buffered data
|
||||||
-- Send EOF if chunk is empty
|
msg._urldeccallback( buffer:sub( 1, #buffer - #chunk ), false )
|
||||||
msg._urldeccallback( buffer:sub( 1, #buffer - #chunk ), ( #chunk == 0 ) )
|
|
||||||
|
|
||||||
-- Store new data
|
-- Store new data
|
||||||
msg._urldeclength = msg._urldeclength + #buffer - #chunk
|
msg._urldeclength = msg._urldeclength + #buffer - #chunk
|
||||||
|
@ -516,7 +515,9 @@ process_states['urldecode-value'] = function( msg, chunk, filecb )
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
return nil, "Unexpected EOF"
|
-- Send EOF
|
||||||
|
msg._urldeccallback( "", true )
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -729,7 +730,7 @@ function parse_message_body( source, msg, filecb )
|
||||||
|
|
||||||
|
|
||||||
-- Unhandled encoding
|
-- Unhandled encoding
|
||||||
-- If a file callback is given then feed it line by line, else
|
-- If a file callback is given then feed it chunk by chunk, else
|
||||||
-- store whole buffer in message.content
|
-- store whole buffer in message.content
|
||||||
else
|
else
|
||||||
|
|
||||||
|
@ -799,4 +800,4 @@ statusmsg = {
|
||||||
[404] = "Not Found",
|
[404] = "Not Found",
|
||||||
[500] = "Internal Server Error",
|
[500] = "Internal Server Error",
|
||||||
[503] = "Server Unavailable",
|
[503] = "Server Unavailable",
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue