summaryrefslogtreecommitdiff
path: root/lib/LuaHttp.cc
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2008-10-17 18:26:38 -0700
committerPixel <pixel@nobis-crew.org>2008-10-17 18:26:38 -0700
commit73a6afb6d7dec1da25fb60a8bf208cf6c419fe92 (patch)
tree46b507cad8efeaea1c10447907bd3a2135c33480 /lib/LuaHttp.cc
parent9e15fad9dd5cdf5f9528dbb8c6b1a864ae94632d (diff)
Fixing various regex issues with the new matches method.
Diffstat (limited to 'lib/LuaHttp.cc')
-rw-r--r--lib/LuaHttp.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/LuaHttp.cc b/lib/LuaHttp.cc
index a3c728a..e9dc90d 100644
--- a/lib/LuaHttp.cc
+++ b/lib/LuaHttp.cc
@@ -398,7 +398,7 @@ LuaDomain::~LuaDomain() {
}
void LuaDomain::Do(const HttpRequest & req, HttpResponse * res) throw (GeneralException) {
- int i;
+ int i, nmatches = 1;
Lua * oldL = L;
Lua * L = oldL->thread(true);
@@ -489,9 +489,10 @@ void LuaDomain::Do(const HttpRequest & req, HttpResponse * res) throw (GeneralEx
L->push("matches");
L->newtable();
- for (i = 0; i < MAX_MATCHES; i++) {
+ for (i = 1; i < MAX_MATCHES; i++) {
if (req.pmatches[i].rm_so == -1)
continue;
+ L->push((lua_Number) nmatches++);
L->newtable();
L->push("start");
L->push((lua_Number) req.pmatches[i].rm_so + 1);
@@ -501,6 +502,7 @@ void LuaDomain::Do(const HttpRequest & req, HttpResponse * res) throw (GeneralEx
L->settable();
L->settable();
}
+ L->settable();
LuaHttpResponse r(res);
r.push(L);