summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/LuaHttp.cc18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/LuaHttp.cc b/lib/LuaHttp.cc
index c746bff..e164eb4 100644
--- a/lib/LuaHttp.cc
+++ b/lib/LuaHttp.cc
@@ -3,6 +3,8 @@
#include "LuaHandle.h"
#include "LuaTask.h"
+#define DOMAIN_REGISTRY "DOMAINS_KEYS"
+
#define export_enum(L, n) \
L->push(#n); \
L->push((lua_Number) HttpResponse::n); \
@@ -68,7 +70,7 @@ void LuaHttpResponse::pushstatics(Lua * L) throw (GeneralException) {
export_enum(L, HTTP_500_INTERNAL_ERROR);
export_enum(L, HTTP_503_SERVICE_UNAVAILABLE);
- L->push("DOMAINS_KEYS");
+ L->push(DOMAIN_REGISTRY);
L->newtable();
L->settable(LUA_REGISTRYINDEX);
}
@@ -132,17 +134,25 @@ class LuaDomain : public Domain {
LuaDomain(Lua * _L, String r) : Domain(r), L(_L) {
id = max_id++;
- L->push("DOMAINS_KEYS");
+ L->push(DOMAIN_REGISTRY);
L->gettable(LUA_REGISTRYINDEX);
L->push((lua_Number) id);
L->copy(2);
L->settable();
+ L->pop();
+ }
+ virtual ~LuaDomain() {
+ L->push(DOMAIN_REGISTRY);
+ L->gettable(LUA_REGISTRYINDEX);
+ L->push((lua_Number id);
+ L->push();
+ L->settable();
+ L->pop();
}
- virtual ~LuaDomain() { }
virtual void Do(const HttpRequest & req, HttpResponse * res) throw (GeneralException) {
int i;
- L->push("DOMAINS_KEYS");
+ L->push(DOMAIN_REGISTRY);
L->gettable(LUA_REGISTRYINDEX);
L->push((lua_Number) id);
L->gettable();