From: Daniel Gruno Date: Mon, 30 Jul 2012 09:06:41 +0000 (+0000) Subject: mod_lua: Pass on the request_rec to ap_lua_get_lua_state, so we can use it for alloca... X-Git-Tag: 2.5.0-alpha~6567 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c67acaa6fcf195758ab665a0e45453f64e7a3c58;p=thirdparty%2Fapache%2Fhttpd.git mod_lua: Pass on the request_rec to ap_lua_get_lua_state, so we can use it for allocating memory for the cache info lookup. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1367040 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/lua/lua_vmprep.c b/modules/lua/lua_vmprep.c index a5f97b80238..5b436de9be8 100644 --- a/modules/lua/lua_vmprep.c +++ b/modules/lua/lua_vmprep.c @@ -338,7 +338,7 @@ static apr_status_t vm_construct(lua_State **vm, void *params, apr_pool_t *lifec * server in the appropriate scope. */ AP_LUA_DECLARE(lua_State*)ap_lua_get_lua_state(apr_pool_t *lifecycle_pool, - ap_lua_vm_spec *spec) + ap_lua_vm_spec *spec, request_rec* r) { lua_State *L = NULL; int tryCache = 0; @@ -365,7 +365,7 @@ AP_LUA_DECLARE(lua_State*)ap_lua_get_lua_state(apr_pool_t *lifecycle_pool, } else { ap_lua_finfo *cache_info; - char* mkey = apr_psprintf(lifecycle_pool, "ap_lua_modified:%s", spec->file); /* XXX: Change to a different pool? */ + char* mkey = apr_psprintf(r->pool, "ap_lua_modified:%s", spec->file); if (apr_pool_userdata_get((void **)&cache_info, mkey, lifecycle_pool) == APR_SUCCESS) { if (cache_info == NULL) { diff --git a/modules/lua/lua_vmprep.h b/modules/lua/lua_vmprep.h index 0669df5802f..29db19a7a15 100644 --- a/modules/lua/lua_vmprep.h +++ b/modules/lua/lua_vmprep.h @@ -121,7 +121,7 @@ AP_LUA_DECLARE(void) ap_lua_load_apache2_lmodule(lua_State *L); * @ctx a baton passed to cb */ AP_LUA_DECLARE(lua_State*) ap_lua_get_lua_state(apr_pool_t *lifecycle_pool, - ap_lua_vm_spec *spec); + ap_lua_vm_spec *spec, request_rec* r); diff --git a/modules/lua/mod_lua.c b/modules/lua/mod_lua.c index 3881f532d89..e2669109c67 100644 --- a/modules/lua/mod_lua.c +++ b/modules/lua/mod_lua.c @@ -191,7 +191,7 @@ static int lua_handler(request_rec *r) ap_lua_vm_spec *spec = create_vm_spec(&pool, r, cfg, NULL, NULL, NULL, 0, "handle", "request handler"); - L = ap_lua_get_lua_state(pool, spec); + L = ap_lua_get_lua_state(pool, spec, r); if (!L) { /* TODO annotate spec with failure reason */ r->status = HTTP_INTERNAL_SERVER_ERROR; @@ -250,7 +250,7 @@ static int lua_request_rec_hook_harness(request_rec *r, const char *name, int ap hook_spec->function_name, "request hook"); - L = ap_lua_get_lua_state(pool, spec); + L = ap_lua_get_lua_state(pool, spec, r); if (!L) { ap_log_rerror(APLOG_MARK, APLOG_CRIT, 0, r, APLOGNO(01477) @@ -1042,7 +1042,7 @@ static authz_status lua_authz_check(request_rec *r, const char *require_line, spec = create_vm_spec(&pool, r, cfg, server_cfg, prov_spec->file_name, NULL, 0, prov_spec->function_name, "authz provider"); - L = ap_lua_get_lua_state(pool, spec); + L = ap_lua_get_lua_state(pool, spec, r); if (L == NULL) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(02314) "Unable to compile VM for authz provider %s", prov_spec->name);