]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
mod_lua: Pass on the request_rec to ap_lua_get_lua_state, so we can use it for alloca...
authorDaniel Gruno <humbedooh@apache.org>
Mon, 30 Jul 2012 09:06:41 +0000 (09:06 +0000)
committerDaniel Gruno <humbedooh@apache.org>
Mon, 30 Jul 2012 09:06:41 +0000 (09:06 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1367040 13f79535-47bb-0310-9956-ffa450edef68

modules/lua/lua_vmprep.c
modules/lua/lua_vmprep.h
modules/lua/mod_lua.c

index a5f97b8023823e8aa9711174b26d8780ab816663..5b436de9be897aec023e334e10a941bf8526df47 100644 (file)
@@ -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) {
index 0669df5802fc445bc7e4207630ceecc224dd6acb..29db19a7a15594021214fdb2fab76758690cbf78 100644 (file)
@@ -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);
 
 
 
index 3881f532d897eafe9353ce19b4e6e81ddd8ba364..e2669109c672c64f007dd5aeaf83756a87ac3872 100644 (file)
@@ -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);