X-Git-Url: http://git.archive.openwrt.org/?a=blobdiff_plain;f=libs%2Fsgi-cgi%2Fluasrc%2Fsgi%2Fcgi.lua;h=f78adeaed60a8ade6874b965abcefd78dd8a7b44;hb=df723f9d9e858d56cdf4cd2fee15e1549a353ad0;hp=0d5ba6ff1b3284035a9e781bdba7e650750b0829;hpb=faed4aa7f1f2a572fed2fb7f691357bdfb42bbe1;p=project%2Fluci.git diff --git a/libs/sgi-cgi/luasrc/sgi/cgi.lua b/libs/sgi-cgi/luasrc/sgi/cgi.lua index 0d5ba6ff1..f78adeaed 100644 --- a/libs/sgi-cgi/luasrc/sgi/cgi.lua +++ b/libs/sgi-cgi/luasrc/sgi/cgi.lua @@ -38,6 +38,7 @@ function run() local x = coroutine.create(luci.dispatcher.httpdispatch) local hcache = "" + local active = true while coroutine.status(x) ~= "dead" do local res, id, data1, data2 = coroutine.resume(x, r) @@ -49,16 +50,20 @@ function run() break; end - if id == 1 then - io.write("Status: " .. tostring(data1) .. " " .. data2 .. "\r\n") - elseif id == 2 then - hcache = hcache .. data1 .. ": " .. data2 .. "\r\n" - elseif id == 3 then - io.write(hcache) - io.write("\r\n") - elseif id == 4 then - io.write(data1) + if active then + if id == 1 then + io.write("Status: " .. tostring(data1) .. " " .. data2 .. "\r\n") + elseif id == 2 then + hcache = hcache .. data1 .. ": " .. data2 .. "\r\n" + elseif id == 3 then + io.write(hcache) + io.write("\r\n") + elseif id == 4 then + io.write(data1) + elseif id == 5 then + io.close() + active = false + end end - end end