You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rj...@apache.org on 2011/11/11 21:51:32 UTC
svn commit: r1201046 - in /httpd/httpd/branches/2.4.x: CHANGES
modules/lua/mod_lua.c
Author: rjung
Date: Fri Nov 11 20:51:32 2011
New Revision: 1201046
URL: http://svn.apache.org/viewvc?rev=1201046&view=rev
Log:
Use the right lua scope when used as a hook.
Backport of r1201042 from trunk.
Modified:
httpd/httpd/branches/2.4.x/CHANGES
httpd/httpd/branches/2.4.x/modules/lua/mod_lua.c (contents, props changed)
Modified: httpd/httpd/branches/2.4.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/CHANGES?rev=1201046&r1=1201045&r2=1201046&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.4.x/CHANGES [utf-8] Fri Nov 11 20:51:32 2011
@@ -1,6 +1,8 @@
-*- coding: utf-8 -*-
Changes with Apache 2.3.16
+ *) mod_lua: Use the right lua scope when used as a hook. [Rainer Jung]
+
*) configure: Only load the really imporant modules (i.e. those enabled by
the 'few' selection) by default. Don't handle modules enabled with
--enable-foo specially. [Stefan Fritsch]
Modified: httpd/httpd/branches/2.4.x/modules/lua/mod_lua.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/lua/mod_lua.c?rev=1201046&r1=1201045&r2=1201046&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/lua/mod_lua.c (original)
+++ httpd/httpd/branches/2.4.x/modules/lua/mod_lua.c Fri Nov 11 20:51:32 2011
@@ -168,6 +168,7 @@ static int lua_handler(request_rec *r)
static int lua_request_rec_hook_harness(request_rec *r, const char *name, int apr_hook_when)
{
int rc;
+ apr_pool_t *pool;
lua_State *L;
ap_lua_vm_spec *spec;
ap_lua_server_cfg *server_cfg = ap_get_module_config(r->server->module_config,
@@ -200,7 +201,31 @@ static int lua_request_rec_hook_harness(
apr_filepath_merge(&spec->file, server_cfg->root_path,
spec->file, APR_FILEPATH_NOTRELATIVE, r->pool);
- L = ap_lua_get_lua_state(r->pool, spec);
+
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+ "request details scope:%u, filename:%s, function:%s",
+ spec->scope,
+ spec->file,
+ hook_spec->function_name ? hook_spec->function_name : "-");
+
+ switch (spec->scope) {
+ case AP_LUA_SCOPE_ONCE:
+ apr_pool_create(&pool, r->pool);
+ break;
+ case AP_LUA_SCOPE_REQUEST:
+ pool = r->pool;
+ break;
+ case AP_LUA_SCOPE_CONN:
+ pool = r->connection->pool;
+ break;
+ case AP_LUA_SCOPE_THREAD:
+ #if APR_HAS_THREADS
+ pool = apr_thread_pool_get(r->connection->current_thread);
+ break;
+ #endif
+ }
+
+ L = ap_lua_get_lua_state(pool, spec);
if (!L) {
ap_log_rerror(APLOG_MARK, APLOG_CRIT, 0, r,
Propchange: httpd/httpd/branches/2.4.x/modules/lua/mod_lua.c
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Nov 11 20:51:32 2011
@@ -1,2 +1,3 @@
/httpd/httpd/branches/revert-ap-ldap/modules/lua/mod_lua.c:1150158-1150173
/httpd/httpd/branches/wombat-integration/modules/wombat/mod_wombat.c:723609-723841
+/httpd/httpd/trunk/modules/lua/mod_lua.c:1201042