1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-05 16:55:50 +03:00

apply patch from zhiguo zhao <zhaozg@gmail.com> to significantly improve server scope handling

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1081611 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brian McCallister
2011-03-14 23:43:23 +00:00
parent 2e3c696eb4
commit 2fed37e78a
3 changed files with 150 additions and 79 deletions

View File

@@ -121,9 +121,15 @@ static int lua_handler(request_rec *r)
d = apr_palloc(r->pool, sizeof(mapped_request_details));
spec = apr_pcalloc(r->pool, sizeof(ap_lua_vm_spec));
spec->scope = dcfg->vm_scope;
spec->pool = r->pool;
spec->pool = spec->scope==APL_SCOPE_SERVER ? cfg->pool : r->pool;
spec->file = r->filename;
spec->code_cache_style = dcfg->code_cache_style;
spec->package_paths = cfg->package_paths;
spec->package_cpaths = cfg->package_cpaths;
spec->vm_server_pool_min = cfg->vm_server_pool_min;
spec->vm_server_pool_max = cfg->vm_server_pool_max;
spec->cb = &lua_open_callback;
spec->cb_arg = NULL;
d->spec = spec;
d->function_name = "handle";
}
@@ -135,10 +141,7 @@ static int lua_handler(request_rec *r)
d->spec->file,
d->function_name);
L = ap_lua_get_lua_state(r->pool,
d->spec,
cfg->package_paths,
cfg->package_cpaths,
&lua_open_callback, NULL);
d->spec);
if (!L) {
/* TODO annotate spec with failure reason */
@@ -246,17 +249,20 @@ static int lua_request_rec_hook_harness(request_rec *r, const char *name)
spec->file = hook_spec->file_name;
spec->code_cache_style = hook_spec->code_cache_style;
spec->scope = hook_spec->scope;
spec->vm_server_pool_min = cfg->vm_server_pool_min;
spec->vm_server_pool_max = cfg->vm_server_pool_max;
spec->bytecode = hook_spec->bytecode;
spec->bytecode_len = hook_spec->bytecode_len;
spec->pool = r->pool;
spec->pool = spec->scope==APL_SCOPE_SERVER ? cfg->pool : r->pool;
spec->package_paths = cfg->package_paths;
spec->package_cpaths = cfg->package_cpaths;
spec->cb = &lua_open_callback;
spec->cb_arg = NULL;
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,
cfg->package_paths,
cfg->package_cpaths,
&lua_open_callback, NULL);
spec);