summaryrefslogtreecommitdiff
path: root/src/mod_magnet_cache.c
diff options
context:
space:
mode:
authorStefan Bühler <stbuehler@web.de>2016-01-03 14:48:09 +0000
committerStefan Bühler <stbuehler@web.de>2016-01-03 14:48:09 +0000
commitc354229f42ac1a21746a5700d00d1745310cd740 (patch)
treeaaf437490b3d1b5b0d191dcae96cf587bdf0e327 /src/mod_magnet_cache.c
parentd8e028e06900b781bebfe2f52cc7254444a31716 (diff)
downloadlighttpd-git-c354229f42ac1a21746a5700d00d1745310cd740.tar.gz
add handling for lua 5.2 and 5.3 (fixes #2674)
Reviewers: stbuehler Differential Revision: https://review.lighttpd.net/D4 From: Stefan Bühler <stbuehler@web.de> git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3070 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'src/mod_magnet_cache.c')
-rw-r--r--src/mod_magnet_cache.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/src/mod_magnet_cache.c b/src/mod_magnet_cache.c
index 0e9f72f8..3804cb80 100644
--- a/src/mod_magnet_cache.c
+++ b/src/mod_magnet_cache.c
@@ -68,6 +68,7 @@ lua_State *script_cache_get_script(server *srv, connection *con, script_cache *c
/* oops, the script failed last time */
if (lua_gettop(sc->L) == 0) break;
+ force_assert(lua_gettop(sc->L) == 1);
if (HANDLER_ERROR == stat_cache_get_entry(srv, con, sc->name, &sce)) {
lua_pop(sc->L, 1); /* pop the old function */
@@ -81,7 +82,6 @@ lua_State *script_cache_get_script(server *srv, connection *con, script_cache *c
}
force_assert(lua_isfunction(sc->L, -1));
- lua_pushvalue(sc->L, -1); /* copy the function-reference */
return sc->L;
}
@@ -114,7 +114,6 @@ lua_State *script_cache_get_script(server *srv, connection *con, script_cache *c
if (0 != luaL_loadfile(sc->L, name->ptr)) {
/* oops, an error, return it */
-
return sc->L;
}
@@ -122,14 +121,7 @@ lua_State *script_cache_get_script(server *srv, connection *con, script_cache *c
buffer_copy_buffer(sc->etag, sce->etag);
}
- /**
- * pcall() needs the function on the stack
- *
- * as pcall() will pop the script from the stack when done, we have to
- * duplicate it here
- */
force_assert(lua_isfunction(sc->L, -1));
- lua_pushvalue(sc->L, -1); /* copy the function-reference */
return sc->L;
}