From 34df4ec1fd048e69e06188392a4278c57a94fe0d Mon Sep 17 00:00:00 2001 From: abadc0de Date: Wed, 27 Feb 2013 15:29:18 -0500 Subject: [PATCH 1/2] Fix mg.onerror returns non-zero to stop processing --- mongoose.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mongoose.c b/mongoose.c index eae4a593..5c2f5f3b 100644 --- a/mongoose.c +++ b/mongoose.c @@ -3979,12 +3979,12 @@ static int lsp(struct mg_connection *conn, const char *path, if (p[j] == '\n') ++lualines; if (p[j] == '?' && p[j + 1] == '>') { mg_write(conn, p + pos, i - pos); - // lua_settop(L, 0); + //lua_settop(L, 0); lua_pushlightuserdata(L, conn); lua_pushcclosure(L, lsp_mg_error, 1); snprintf (chunkname, sizeof(chunkname), "@%s+%i", path, lines); if (luaL_loadbuffer(L, p + (i + 2), j - (i + 2), chunkname)) { - lua_pcall(L, 1, 0, 0); + lua_pcall(L, 1, 1, 0); result = lua_tointeger(L, -1); if (result) return result; } else { From 10234b07c4c90382adf98336890df22ecc60c8a9 Mon Sep 17 00:00:00 2001 From: abadc0de Date: Wed, 27 Feb 2013 16:33:05 -0500 Subject: [PATCH 2/2] Remove dead code --- mongoose.c | 1 - 1 file changed, 1 deletion(-) diff --git a/mongoose.c b/mongoose.c index c7fd9f01..a96aaa09 100644 --- a/mongoose.c +++ b/mongoose.c @@ -3979,7 +3979,6 @@ static int lsp(struct mg_connection *conn, const char *path, if (p[j] == '\n') ++lualines; if (p[j] == '?' && p[j + 1] == '>') { mg_write(conn, p + pos, i - pos); - //lua_settop(L, 0); lua_pushlightuserdata(L, conn); lua_pushcclosure(L, lsp_mg_error, 1); snprintf (chunkname, sizeof(chunkname), "@%s+%i", path, lines);