From 56f57e2a505e5725f8d2fbe5c887dcf9d53e58f7 Mon Sep 17 00:00:00 2001 From: mvoelkel Date: Thu, 24 Sep 2015 19:10:27 +0200 Subject: [PATCH] updateserver setting: handle url encoded strings --- octoserve/var/www/updateserver.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/octoserve/var/www/updateserver.lua b/octoserve/var/www/updateserver.lua index 5e39811..983f7d4 100644 --- a/octoserve/var/www/updateserver.lua +++ b/octoserve/var/www/updateserver.lua @@ -12,6 +12,10 @@ function http_print(s) end end +local hex_to_char = function(x) + return string.char(tonumber(x,16)) +end + local userver = "download.digital-devices.de/download/linux" local data = nil local delimages = false @@ -33,6 +37,8 @@ elseif query == "set=std" then elseif query:sub(1,4) == "set=" then userver = query:sub(5) if userver ~= "" then + userver = userver:gsub("%%(%x%x)",hex_to_char) + -- userver = userver:gsub("+"," ") local file = io.open("/config/updateserver","w") if file then file:write(userver.."\n") @@ -64,6 +70,7 @@ end if data then http_print(proto.." 200" ) http_print("Pragma: no-cache") + http_print("Cache-Control: no-cache") http_print("Content-Type: application/json; charset=UTF-8") http_print(string.format("Content-Length: %d",#data)) http_print()