X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=libs%2Fsgi-cgi%2Fluasrc%2Fsgi%2Fcgi.lua;h=0d5ba6ff1b3284035a9e781bdba7e650750b0829;hp=5555e4a0586c4b76b05d8f14d67c46a8c3c7a8a6;hb=faed4aa7f1f2a572fed2fb7f691357bdfb42bbe1;hpb=00aceaf624d8e5da2a8f3df161d52599aae2ac41 diff --git a/libs/sgi-cgi/luasrc/sgi/cgi.lua b/libs/sgi-cgi/luasrc/sgi/cgi.lua index 5555e4a05..0d5ba6ff1 100644 --- a/libs/sgi-cgi/luasrc/sgi/cgi.lua +++ b/libs/sgi-cgi/luasrc/sgi/cgi.lua @@ -24,7 +24,7 @@ limitations under the License. ]]-- module("luci.sgi.cgi", package.seeall) -require("ltn12") +local ltn12 = require("luci.ltn12") require("luci.http") require("luci.sys") require("luci.dispatcher") @@ -37,6 +37,7 @@ function run() ) local x = coroutine.create(luci.dispatcher.httpdispatch) + local hcache = "" while coroutine.status(x) ~= "dead" do local res, id, data1, data2 = coroutine.resume(x, r) @@ -49,11 +50,12 @@ function run() end if id == 1 then - io.write("Status: " .. tostring(data1) .. " " .. data2 .. "\n") + io.write("Status: " .. tostring(data1) .. " " .. data2 .. "\r\n") elseif id == 2 then - io.write(data1 .. ": " .. data2 .. "\n") + hcache = hcache .. data1 .. ": " .. data2 .. "\r\n" elseif id == 3 then - io.write("\n") + io.write(hcache) + io.write("\r\n") elseif id == 4 then io.write(data1) end