Fix sgi-wsapi and sgi-luci to be standards compliant
authorSteven Barth <steven@midlink.org>
Wed, 23 Jul 2008 18:31:47 +0000 (18:31 +0000)
committerSteven Barth <steven@midlink.org>
Wed, 23 Jul 2008 18:31:47 +0000 (18:31 +0000)
libs/httpd/luasrc/httpd/handler/luci.lua
libs/sgi-wsapi/luasrc/sgi/wsapi.lua

index 65f3f01b25ab537ecbd0c55399d0b8ebd0435e1e..18715111f8c42c74d175615dcb090dc624ef1564 100644 (file)
@@ -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() )
index ebae9fc2778dfeff8bd2fa64364197639c76911e..3b53025990409250c76db8e8c813daaaf2f2d446 100644 (file)
@@ -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