* libs/web: Reworked authentication
[project/luci.git] / libs / httpd / luasrc / httpd / handler / luci.lua
index 1871511..ac3ed78 100644 (file)
@@ -32,7 +32,6 @@ end
 
 function Luci.handle_head(self, ...)
        local response, sourceout = self:handle_get(...)
-       self.running = self.running - 1
        return response
 end
 
@@ -55,6 +54,7 @@ function Luci.handle_get(self, request, sourcein, sinkerr)
        local res, id, data1, data2 = true, 0, nil, nil
        local headers = {}
        local status = 200
+       local active = true
 
        local x = coroutine.create(luci.dispatcher.httpdispatch)
        while not id or id < 3 do
@@ -66,7 +66,6 @@ function Luci.handle_get(self, request, sourcein, sinkerr)
                        status = 500
                        headers["Content-Type"] = "text/plain"
                        local err = {id}
-                       self.running = self.running - 1
                        return Response( status, headers ), function() return table.remove(err) end
                end
 
@@ -81,9 +80,10 @@ function Luci.handle_get(self, request, sourcein, sinkerr)
                local res, id, data = coroutine.resume(x)
                if not res then
                        return nil, id
-               elseif not id then
+               elseif not id or not active then
                        return true
                elseif id == 5 then
+                       active = false
                        return true
                elseif id == 4 then
                        return data