From 59bef00fc3a9019733103661e67268f55c93ae17 Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Wed, 23 Jul 2008 18:31:47 +0000 Subject: [PATCH] Fix sgi-wsapi and sgi-luci to be standards compliant --- libs/httpd/luasrc/httpd/handler/luci.lua | 7 +++++-- libs/sgi-wsapi/luasrc/sgi/wsapi.lua | 11 +++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/libs/httpd/luasrc/httpd/handler/luci.lua b/libs/httpd/luasrc/httpd/handler/luci.lua index 65f3f01b2..18715111f 100644 --- a/libs/httpd/luasrc/httpd/handler/luci.lua +++ b/libs/httpd/luasrc/httpd/handler/luci.lua @@ -84,10 +84,13 @@ function Luci.handle_get(self, request, sourcein, sinkerr) elseif not id then return true elseif id == 5 then - return nil - else + return true + elseif id == 4 then return data end + if coroutine.status(x) == "dead" then + return nil + end end headers["Expires"] = luci.http.protocol.date.to_http( os.time() ) diff --git a/libs/sgi-wsapi/luasrc/sgi/wsapi.lua b/libs/sgi-wsapi/luasrc/sgi/wsapi.lua index ebae9fc27..3b5302599 100644 --- a/libs/sgi-wsapi/luasrc/sgi/wsapi.lua +++ b/libs/sgi-wsapi/luasrc/sgi/wsapi.lua @@ -59,11 +59,14 @@ function run(wsapi_env) end local function iter() - local res, id, data1, data2 = coroutine.resume(x) - if not res or id == 5 then + local res, id, data = coroutine.resume(x) + if id == 4 then + return data + elseif id == 5 then + return "" + end + if coroutine.status(x) == "dead" then return nil - else - return data1 end end -- 2.11.0