X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=libs%2Fhttp%2Fluasrc%2Fhttp%2Fprotocol.lua;h=4cb89779be1652f92a60d6f3b228cf95667fba3c;hp=1fdb5d67969b533ff3c55bb1dd8b43643448ce51;hb=8895d236ea88af79d23e55a7482d3822060f4493;hpb=40988c4b36c5c229ab1deca00ba04efebe036e09 diff --git a/libs/http/luasrc/http/protocol.lua b/libs/http/luasrc/http/protocol.lua index 1fdb5d679..4cb89779b 100644 --- a/libs/http/luasrc/http/protocol.lua +++ b/libs/http/luasrc/http/protocol.lua @@ -311,7 +311,7 @@ function mimedecode_message_body( src, msg, filecb ) tlen = tlen + ( chunk and #chunk or 0 ) - if msg.env.CONTENT_LENGTH and tlen > msg.env.CONTENT_LENGTH then + if msg.env.CONTENT_LENGTH and tlen > tonumber(msg.env.CONTENT_LENGTH) then return nil, "Message body size exceeds Content-Length" end @@ -413,7 +413,7 @@ function urldecode_message_body( src, msg ) tlen = tlen + ( chunk and #chunk or 0 ) - if msg.env.CONTENT_LENGTH and tlen > msg.env.CONTENT_LENGTH then + if msg.env.CONTENT_LENGTH and tlen > tonumber(msg.env.CONTENT_LENGTH) then return nil, "Message body size exceeds Content-Length" elseif tlen > HTTP_MAX_CONTENT then return nil, "Message body size exceeds maximum allowed length" @@ -490,7 +490,7 @@ function parse_message_header( source ) -- Populate common environment variables msg.env = { - CONTENT_LENGTH = tonumber(msg.headers['Content-Length']); + CONTENT_LENGTH = msg.headers['Content-Length']; CONTENT_TYPE = msg.headers['Content-Type']; REQUEST_METHOD = msg.request_method:upper(); REQUEST_URI = msg.request_uri;