summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2014-03-28 16:37:03 +0000
committerJo-Philipp Wich <jow@openwrt.org>2014-03-28 16:37:03 +0000
commit0efb19876b0fe85aabdbb1634c8d5001e2cd2c65 (patch)
tree0ada0d6c761cbc6ac4483848e9259858bdf5ce89
parentde5da20be1ed099c8d3ea77f26ac5ae65e94d4e9 (diff)
libs/sgi-uhttpd: do not assume env.CONTENT_LENGTH to be a number
env.CONTENT_LENGTH as passed by uhttpd might be a string, so explicitely convert it using tonumber(). Issue has been reported by Catalin Patulea <cat@vv.carleton.ca> Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
-rw-r--r--libs/sgi-uhttpd/luasrc/sgi/uhttpd.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/libs/sgi-uhttpd/luasrc/sgi/uhttpd.lua b/libs/sgi-uhttpd/luasrc/sgi/uhttpd.lua
index 5915b6980..bca874e46 100644
--- a/libs/sgi-uhttpd/luasrc/sgi/uhttpd.lua
+++ b/libs/sgi-uhttpd/luasrc/sgi/uhttpd.lua
@@ -43,7 +43,7 @@ function handle_request(env)
renv["HTTP_" .. k] = v
end
- local len = env.CONTENT_LENGTH or 0
+ local len = tonumber(env.CONTENT_LENGTH) or 0
local function recv()
if len > 0 then
local rlen, rbuf = uhttpd.recv(4096)