summaryrefslogtreecommitdiff
path: root/lib/LuaHttp.cc
diff options
context:
space:
mode:
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);