1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-08 15:02:10 +03:00

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
This commit is contained in:
Daniel Gruno
2012-07-30 09:06:41 +00:00
parent 241fc01bd9
commit c67acaa6fc
3 changed files with 6 additions and 6 deletions

View 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. * server in the appropriate scope.
*/ */
AP_LUA_DECLARE(lua_State*)ap_lua_get_lua_state(apr_pool_t *lifecycle_pool, 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; lua_State *L = NULL;
int tryCache = 0; int tryCache = 0;
@@ -365,7 +365,7 @@ AP_LUA_DECLARE(lua_State*)ap_lua_get_lua_state(apr_pool_t *lifecycle_pool,
} }
else { else {
ap_lua_finfo *cache_info; 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, if (apr_pool_userdata_get((void **)&cache_info, mkey,
lifecycle_pool) == APR_SUCCESS) { lifecycle_pool) == APR_SUCCESS) {
if (cache_info == NULL) { if (cache_info == NULL) {

View File

@@ -121,7 +121,7 @@ AP_LUA_DECLARE(void) ap_lua_load_apache2_lmodule(lua_State *L);
* @ctx a baton passed to cb * @ctx a baton passed to cb
*/ */
AP_LUA_DECLARE(lua_State*) ap_lua_get_lua_state(apr_pool_t *lifecycle_pool, 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);

View 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, ap_lua_vm_spec *spec = create_vm_spec(&pool, r, cfg, NULL, NULL, NULL,
0, "handle", "request handler"); 0, "handle", "request handler");
L = ap_lua_get_lua_state(pool, spec); L = ap_lua_get_lua_state(pool, spec, r);
if (!L) { if (!L) {
/* TODO annotate spec with failure reason */ /* TODO annotate spec with failure reason */
r->status = HTTP_INTERNAL_SERVER_ERROR; 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, hook_spec->function_name,
"request hook"); "request hook");
L = ap_lua_get_lua_state(pool, spec); L = ap_lua_get_lua_state(pool, spec, r);
if (!L) { if (!L) {
ap_log_rerror(APLOG_MARK, APLOG_CRIT, 0, r, APLOGNO(01477) 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, spec = create_vm_spec(&pool, r, cfg, server_cfg, prov_spec->file_name,
NULL, 0, prov_spec->function_name, "authz provider"); 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) { if (L == NULL) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(02314) ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(02314)
"Unable to compile VM for authz provider %s", prov_spec->name); "Unable to compile VM for authz provider %s", prov_spec->name);