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

Rename most of the module formally known as mod_wombat to mod_lua conventions, switching apw prefixes for apl.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@728506 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Paul Querna
2008-12-21 21:17:15 +00:00
parent badab85d11
commit afcdc6d85c
9 changed files with 228 additions and 227 deletions

View File

@@ -4,6 +4,7 @@
#include "lua.h" #include "lua.h"
#include "lauxlib.h" #include "lauxlib.h"
#include "lualib.h" #include "lualib.h"
#include "apr_lua.h"
/** /**
* make a userdata out of a C pointer, and vice versa * make a userdata out of a C pointer, and vice versa
@@ -22,7 +23,7 @@ apr_table_t* check_apr_table(lua_State* L, int index) {
} }
void apw_push_apr_table(lua_State* L, const char *name, apr_table_t *t) { void apl_push_apr_table(lua_State* L, const char *name, apr_table_t *t) {
lua_boxpointer(L, t); lua_boxpointer(L, t);
luaL_getmetatable(L, "Apr.Table"); luaL_getmetatable(L, "Apr.Table");
lua_setmetatable(L, -2); lua_setmetatable(L, -2);

View File

@@ -3,6 +3,6 @@
int apr_lua_init(lua_State *L, apr_pool_t *p); int apr_lua_init(lua_State *L, apr_pool_t *p);
apr_table_t* check_apr_table(lua_State* L, int index); apr_table_t* check_apr_table(lua_State* L, int index);
void apw_push_apr_table(lua_State* L, const char *name, apr_table_t *t); void apl_push_apr_table(lua_State* L, const char *name, apr_table_t *t);
#endif #endif

View File

@@ -17,16 +17,16 @@
#include "mod_lua.h" #include "mod_lua.h"
#ifndef APW_CONFIG_H #ifndef _APL_CONFIG_H_
#define APW_CONFIG_H #define _APL_CONFIG_H_
APR_DECLARE(void) apw_load_config_lmodule(lua_State *L); APR_DECLARE(void) apl_load_config_lmodule(lua_State *L);
APR_DECLARE(apr_status_t) apw_lua_map_handler(apw_dir_cfg *cfg, APR_DECLARE(apr_status_t) apl_lua_map_handler(apl_dir_cfg *cfg,
const char *file, const char *file,
const char *function, const char *function,
const char *pattern, const char *pattern,
const char *scope); const char *scope);
#endif #endif /* !_APL_CONFIG_H_ */

View File

@@ -23,12 +23,12 @@
#include "apr_lua.h" #include "apr_lua.h"
APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(apw, WOMBAT, int, wombat_open, APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(apl, AP_LUA, int, lua_open,
(lua_State *L, apr_pool_t *p), (lua_State *L, apr_pool_t *p),
(L, p), (L, p),
OK, DECLINED) OK, DECLINED)
APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(apw, WOMBAT, int, wombat_request, APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(apl, AP_LUA, int, lua_request,
(lua_State *L, request_rec *r), (lua_State *L, request_rec *r),
(L, r), (L, r),
OK, DECLINED) OK, DECLINED)
@@ -52,20 +52,20 @@ static void report_lua_error(lua_State *L, request_rec *r) {
ap_log_perror(APLOG_MARK, APLOG_WARNING, 0, r->pool, "Lua error: %s", lua_response); ap_log_perror(APLOG_MARK, APLOG_WARNING, 0, r->pool, "Lua error: %s", lua_response);
} }
static void wombat_open_callback(lua_State *L, apr_pool_t *p, void* ctx) { static void lua_open_callback(lua_State *L, apr_pool_t *p, void* ctx) {
apr_lua_init(L, p); apr_lua_init(L, p);
apw_load_apache2_lmodule(L); apl_load_apache2_lmodule(L);
apw_load_request_lmodule(L, p); apl_load_request_lmodule(L, p);
apw_load_config_lmodule(L); apl_load_config_lmodule(L);
} }
static int wombat_open_hook(lua_State *L, apr_pool_t *p) { static int lua_open_hook(lua_State *L, apr_pool_t *p) {
wombat_open_callback(L, p, NULL); lua_open_callback(L, p, NULL);
return OK; return OK;
} }
/* /*
static apr_status_t wombathood(ap_filter_t *f, apr_bucket_brigade *bb) { static apr_status_t luahood(ap_filter_t *f, apr_bucket_brigade *bb) {
apr_bucket* b; apr_bucket* b;
apr_status_t rs; apr_status_t rs;
for ( b = APR_BRIGADE_FIRST(bb); for ( b = APR_BRIGADE_FIRST(bb);
@@ -78,7 +78,7 @@ static apr_status_t wombathood(ap_filter_t *f, apr_bucket_brigade *bb) {
const char *buffer; const char *buffer;
size_t bytes; size_t bytes;
if (( rs = apr_bucket_read(b, &buffer, &bytes, APR_BLOCK_READ))) { if (( rs = apr_bucket_read(b, &buffer, &bytes, APR_BLOCK_READ))) {
ap_log_rerror(APLOG_MARK, APLOG_WARNING, rs, f->r, "read failure in wombathood"); ap_log_rerror(APLOG_MARK, APLOG_WARNING, rs, f->r, "read failure in luahood");
return rs; return rs;
} }
char *mine = apr_pstrmemdup(f->r->pool, buffer, bytes); char *mine = apr_pstrmemdup(f->r->pool, buffer, bytes);
@@ -94,21 +94,21 @@ static apr_status_t wombathood(ap_filter_t *f, apr_bucket_brigade *bb) {
/** /**
* "main" * "main"
*/ */
static int wombat_handler(request_rec *r) { static int lua_handler(request_rec *r) {
if (strcmp(r->handler, "lua-script")) { if (strcmp(r->handler, "lua-script")) {
return DECLINED; return DECLINED;
} }
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "handling [%s] in mod_wombat", r->filename); ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "handling [%s] in mod_lua", r->filename);
apw_dir_cfg *dcfg = ap_get_module_config(r->per_dir_config, &lua_module); apl_dir_cfg *dcfg = ap_get_module_config(r->per_dir_config, &lua_module);
if (!r->header_only) { if (!r->header_only) {
apw_request_cfg* rcfg = ap_get_module_config(r->request_config, &lua_module); apl_request_cfg* rcfg = ap_get_module_config(r->request_config, &lua_module);
mapped_request_details *d = rcfg->mapped_request_details; mapped_request_details *d = rcfg->mapped_request_details;
apw_vm_spec *spec = NULL; apl_vm_spec *spec = NULL;
if (!d) { if (!d) {
d = apr_palloc(r->pool, sizeof(mapped_request_details)); d = apr_palloc(r->pool, sizeof(mapped_request_details));
spec = apr_pcalloc(r->pool, sizeof(apw_vm_spec)); spec = apr_pcalloc(r->pool, sizeof(apl_vm_spec));
spec->scope = dcfg->vm_scope; spec->scope = dcfg->vm_scope;
spec->pool = r->pool; spec->pool = r->pool;
spec->file = r->filename; spec->file = r->filename;
@@ -119,12 +119,12 @@ static int wombat_handler(request_rec *r) {
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "request details scope:%u, cache:%u", ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "request details scope:%u, cache:%u",
d->spec->scope, d->spec->scope,
d->spec->code_cache_style); d->spec->code_cache_style);
const apw_dir_cfg* cfg = ap_get_module_config(r->per_dir_config, &lua_module); const apl_dir_cfg* cfg = ap_get_module_config(r->per_dir_config, &lua_module);
lua_State *L = apw_get_lua_state(r->pool, lua_State *L = apl_get_lua_state(r->pool,
d->spec->file, d->spec->file,
cfg->package_paths, cfg->package_paths,
cfg->package_cpaths, cfg->package_cpaths,
&wombat_open_callback, NULL); &lua_open_callback, NULL);
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "got a vm!"); ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "got a vm!");
if (!L) { if (!L) {
@@ -133,7 +133,7 @@ static int wombat_handler(request_rec *r) {
ap_rputs("Unable to compile VM, see logs", r); ap_rputs("Unable to compile VM, see logs", r);
} }
lua_getglobal(L, d->function_name); lua_getglobal(L, d->function_name);
apw_run_wombat_request(L, r); apl_run_lua_request(L, r);
if (lua_pcall(L, 1, 0, 0)) { if (lua_pcall(L, 1, 0, 0)) {
report_lua_error(L, r); report_lua_error(L, r);
} }
@@ -146,24 +146,24 @@ static int wombat_handler(request_rec *r) {
/** /**
* Like mod_alias except for lua handler fun :-) * Like mod_alias except for lua handler fun :-)
*/ */
static int apw_alias_munger(request_rec *r) { static int apl_alias_munger(request_rec *r) {
const apw_dir_cfg *cfg = ap_get_module_config(r->per_dir_config, &lua_module); const apl_dir_cfg *cfg = ap_get_module_config(r->per_dir_config, &lua_module);
int i; int i;
ap_regmatch_t matches[AP_MAX_REG_MATCH]; ap_regmatch_t matches[AP_MAX_REG_MATCH];
for (i = 0; i < cfg->mapped_handlers->nelts; i++) { for (i = 0; i < cfg->mapped_handlers->nelts; i++) {
const apw_mapped_handler_spec *cnd = ((const apw_mapped_handler_spec**)cfg->mapped_handlers->elts)[i]; const apl_mapped_handler_spec *cnd = ((const apl_mapped_handler_spec**)cfg->mapped_handlers->elts)[i];
if (OK == ap_regexec(cnd->uri_pattern, r->uri, AP_MAX_REG_MATCH, matches, 0)) { if (OK == ap_regexec(cnd->uri_pattern, r->uri, AP_MAX_REG_MATCH, matches, 0)) {
r->handler = "lua-script"; r->handler = "lua-script";
apw_vm_spec *spec = apr_pcalloc(r->pool, sizeof(apw_vm_spec)); apl_vm_spec *spec = apr_pcalloc(r->pool, sizeof(apl_vm_spec));
spec->file = ap_pregsub(r->pool, cnd->file_name, r->uri, AP_MAX_REG_MATCH, matches); spec->file = ap_pregsub(r->pool, cnd->file_name, r->uri, AP_MAX_REG_MATCH, matches);
spec->scope = cnd->scope; spec->scope = cnd->scope;
spec->code_cache_style = cnd->code_cache_style; spec->code_cache_style = cnd->code_cache_style;
spec->bytecode = cnd->bytecode; spec->bytecode = cnd->bytecode;
spec->bytecode_len = cnd->bytecode_len; spec->bytecode_len = cnd->bytecode_len;
if (spec->scope == APW_SCOPE_ONCE) { if (spec->scope == APL_SCOPE_ONCE) {
spec->pool = r->pool; spec->pool = r->pool;
} }
@@ -174,7 +174,7 @@ static int apw_alias_munger(request_rec *r) {
/* now do replacement on method name where? */ /* now do replacement on method name where? */
r->filename = apr_pstrdup(r->pool, spec->file); r->filename = apr_pstrdup(r->pool, spec->file);
apw_request_cfg *rcfg = ap_get_module_config(r->request_config, &lua_module); apl_request_cfg *rcfg = ap_get_module_config(r->request_config, &lua_module);
rcfg->mapped_request_details = d; rcfg->mapped_request_details = d;
return OK; return OK;
} }
@@ -186,18 +186,18 @@ static int apw_alias_munger(request_rec *r) {
/** harnesses for magic hooks **/ /** harnesses for magic hooks **/
static int wombat_request_rec_hook_harness(request_rec *r, const char *name) { static int lua_request_rec_hook_harness(request_rec *r, const char *name) {
char *fixed_filename; char *fixed_filename;
const apw_dir_cfg* cfg = (apw_dir_cfg*) ap_get_module_config(r->per_dir_config, const apl_dir_cfg* cfg = (apl_dir_cfg*) ap_get_module_config(r->per_dir_config,
&lua_module); &lua_module);
apr_array_header_t *hook_specs = apr_hash_get(cfg->hooks, name, APR_HASH_KEY_STRING); apr_array_header_t *hook_specs = apr_hash_get(cfg->hooks, name, APR_HASH_KEY_STRING);
if (hook_specs) { if (hook_specs) {
int i; int i;
for (i=0; i < hook_specs->nelts; i++) { for (i=0; i < hook_specs->nelts; i++) {
apw_mapped_handler_spec *hook_spec = ((apw_mapped_handler_spec**)hook_specs->elts)[i]; apl_mapped_handler_spec *hook_spec = ((apl_mapped_handler_spec**)hook_specs->elts)[i];
if (hook_spec == NULL) continue; if (hook_spec == NULL) continue;
apw_vm_spec *spec = apr_pcalloc(r->pool, sizeof(apw_vm_spec)); apl_vm_spec *spec = apr_pcalloc(r->pool, sizeof(apl_vm_spec));
spec->file = hook_spec->file_name; spec->file = hook_spec->file_name;
spec->code_cache_style = hook_spec->code_cache_style; spec->code_cache_style = hook_spec->code_cache_style;
@@ -207,25 +207,25 @@ static int wombat_request_rec_hook_harness(request_rec *r, const char *name) {
spec->pool = r->pool; spec->pool = r->pool;
/* /*
const apw_dir_cfg* cfg = ap_get_module_config(r->per_dir_config, &lua_module); const apl_dir_cfg* cfg = ap_get_module_config(r->per_dir_config, &lua_module);
lua_State *L = apw_get_lua_state(r->pool, lua_State *L = apl_get_lua_state(r->pool,
d->spec->file, d->spec->file,
cfg->package_paths, cfg->package_paths,
cfg->package_cpaths, cfg->package_cpaths,
&wombat_open_callback, NULL); &lua_open_callback, NULL);
*/ */
apw_server_cfg *server_cfg = ap_get_module_config(r->server->module_config, &lua_module); apl_server_cfg *server_cfg = ap_get_module_config(r->server->module_config, &lua_module);
apr_filepath_merge(&fixed_filename, server_cfg->root_path, spec->file, APR_FILEPATH_NOTRELATIVE, r->pool); apr_filepath_merge(&fixed_filename, server_cfg->root_path, spec->file, APR_FILEPATH_NOTRELATIVE, r->pool);
lua_State *L = apw_get_lua_state(r->pool, lua_State *L = apl_get_lua_state(r->pool,
fixed_filename, fixed_filename,
cfg->package_paths, cfg->package_paths,
cfg->package_cpaths, cfg->package_cpaths,
&wombat_open_callback, NULL); &lua_open_callback, NULL);
if (!L) { if (!L) {
ap_log_rerror(APLOG_MARK, APLOG_CRIT, 0, r, "wombat: Failed to obtain lua interpreter for %s %s", ap_log_rerror(APLOG_MARK, APLOG_CRIT, 0, r, "lua: Failed to obtain lua interpreter for %s %s",
hook_spec->function_name, hook_spec->function_name,
hook_spec->file_name); hook_spec->file_name);
return 500; return 500;
@@ -234,16 +234,16 @@ static int wombat_request_rec_hook_harness(request_rec *r, const char *name) {
if (hook_spec->function_name != NULL) { if (hook_spec->function_name != NULL) {
lua_getglobal(L, hook_spec->function_name); lua_getglobal(L, hook_spec->function_name);
if (!lua_isfunction(L, -1)) { if (!lua_isfunction(L, -1)) {
ap_log_rerror(APLOG_MARK, APLOG_CRIT, 0, r, "wombat: Unable to find function %s in %s", ap_log_rerror(APLOG_MARK, APLOG_CRIT, 0, r, "lua: Unable to find function %s in %s",
hook_spec->function_name, hook_spec->function_name,
hook_spec->file_name); hook_spec->file_name);
return 500; return 500;
} }
apw_run_wombat_request(L, r); apl_run_lua_request(L, r);
} }
else { else {
apw_run_wombat_request(L, r); apl_run_lua_request(L, r);
int t = lua_gettop(L); int t = lua_gettop(L);
lua_setglobal(L, "r"); lua_setglobal(L, "r");
@@ -349,7 +349,7 @@ static int ldump_writer (lua_State *L, const void* b, size_t size, void* B) {
typedef struct hack_section_baton { typedef struct hack_section_baton {
const char *name; const char *name;
apw_mapped_handler_spec *spec; apl_mapped_handler_spec *spec;
} hack_section_baton; } hack_section_baton;
/* You can be unhappy now. /* You can be unhappy now.
@@ -364,19 +364,19 @@ typedef struct hack_section_baton {
*/ */
static const char *hack_section_handler(cmd_parms *cmd, void *_cfg, const char *arg) static const char *hack_section_handler(cmd_parms *cmd, void *_cfg, const char *arg)
{ {
apw_dir_cfg* cfg = (apw_dir_cfg*)_cfg; apl_dir_cfg* cfg = (apl_dir_cfg*)_cfg;
ap_directive_t *directive = cmd->directive; ap_directive_t *directive = cmd->directive;
hack_section_baton* baton = directive->data; hack_section_baton* baton = directive->data;
apr_array_header_t *hook_specs = apr_hash_get(cfg->hooks, baton->name, APR_HASH_KEY_STRING); apr_array_header_t *hook_specs = apr_hash_get(cfg->hooks, baton->name, APR_HASH_KEY_STRING);
if (!hook_specs) { if (!hook_specs) {
hook_specs = apr_array_make(cmd->pool, 2, sizeof(apw_mapped_handler_spec*)); hook_specs = apr_array_make(cmd->pool, 2, sizeof(apl_mapped_handler_spec*));
apr_hash_set(cfg->hooks, apr_pstrdup(cmd->pool, baton->name), APR_HASH_KEY_STRING, hook_specs); apr_hash_set(cfg->hooks, apr_pstrdup(cmd->pool, baton->name), APR_HASH_KEY_STRING, hook_specs);
} }
baton->spec->scope = cfg->vm_scope; baton->spec->scope = cfg->vm_scope;
*(apw_mapped_handler_spec**)apr_array_push(hook_specs) = baton->spec; *(apl_mapped_handler_spec**)apr_array_push(hook_specs) = baton->spec;
return NULL; return NULL;
} }
@@ -404,7 +404,7 @@ static const char *register_named_block_function_hook(const char *name,
} }
} }
apw_mapped_handler_spec *spec = apr_pcalloc(cmd->pool, sizeof(apw_mapped_handler_spec)); apl_mapped_handler_spec *spec = apr_pcalloc(cmd->pool, sizeof(apl_mapped_handler_spec));
{ {
cr_ctx ctx; cr_ctx ctx;
@@ -421,7 +421,7 @@ static const char *register_named_block_function_hook(const char *name,
else { else {
function = NULL; function = NULL;
} }
spec->code_cache_style = APW_CODE_CACHE_FOREVER; spec->code_cache_style = APL_CODE_CACHE_FOREVER;
ctx.cmd = cmd; ctx.cmd = cmd;
tmp = apr_pstrdup(cmd->pool, cmd->err_directive->directive+1); tmp = apr_pstrdup(cmd->pool, cmd->err_directive->directive+1);
@@ -478,66 +478,66 @@ static const char* register_named_file_function_hook(const char *name,
void *_cfg, void *_cfg,
const char *file, const char *file,
const char *function) { const char *function) {
apw_dir_cfg* cfg = (apw_dir_cfg*)_cfg; apl_dir_cfg* cfg = (apl_dir_cfg*)_cfg;
apr_array_header_t *hook_specs = apr_hash_get(cfg->hooks, name, APR_HASH_KEY_STRING); apr_array_header_t *hook_specs = apr_hash_get(cfg->hooks, name, APR_HASH_KEY_STRING);
if (!hook_specs) { if (!hook_specs) {
hook_specs = apr_array_make(cmd->pool, 2, sizeof(apw_mapped_handler_spec*)); hook_specs = apr_array_make(cmd->pool, 2, sizeof(apl_mapped_handler_spec*));
apr_hash_set(cfg->hooks, apr_pstrdup(cmd->pool, name), APR_HASH_KEY_STRING, hook_specs); apr_hash_set(cfg->hooks, apr_pstrdup(cmd->pool, name), APR_HASH_KEY_STRING, hook_specs);
} }
apw_mapped_handler_spec *spec = apr_pcalloc(cmd->pool, sizeof(apw_mapped_handler_spec)); apl_mapped_handler_spec *spec = apr_pcalloc(cmd->pool, sizeof(apl_mapped_handler_spec));
spec->file_name = apr_pstrdup(cmd->pool, file); spec->file_name = apr_pstrdup(cmd->pool, file);
spec->function_name = apr_pstrdup(cmd->pool, function); spec->function_name = apr_pstrdup(cmd->pool, function);
spec->scope = cfg->vm_scope; spec->scope = cfg->vm_scope;
spec->code_cache_style = APW_CODE_CACHE_STAT; spec->code_cache_style = APL_CODE_CACHE_STAT;
/* /*
int code_cache_style; int code_cache_style;
char *function_name; char *function_name;
char *file_name; char *file_name;
int scope; int scope;
*/ */
*(apw_mapped_handler_spec**)apr_array_push(hook_specs) = spec; *(apl_mapped_handler_spec**)apr_array_push(hook_specs) = spec;
return NULL; return NULL;
} }
int wombat_check_user_id_harness(request_rec *r) { int lua_check_user_id_harness(request_rec *r) {
return wombat_request_rec_hook_harness(r, "check_user_id"); return lua_request_rec_hook_harness(r, "check_user_id");
} }
int wombat_translate_name_harness(request_rec *r) { int lua_translate_name_harness(request_rec *r) {
return wombat_request_rec_hook_harness(r, "translate_name"); return lua_request_rec_hook_harness(r, "translate_name");
} }
int wombat_fixup_harness(request_rec *r) { int lua_fixup_harness(request_rec *r) {
return wombat_request_rec_hook_harness(r, "fixups"); return lua_request_rec_hook_harness(r, "fixups");
} }
int wombat_map_to_storage_harness(request_rec *r) { int lua_map_to_storage_harness(request_rec *r) {
return wombat_request_rec_hook_harness(r, "map_to_storage"); return lua_request_rec_hook_harness(r, "map_to_storage");
} }
int wombat_type_checker_harness(request_rec *r) { int lua_type_checker_harness(request_rec *r) {
return wombat_request_rec_hook_harness(r, "type_checker"); return lua_request_rec_hook_harness(r, "type_checker");
} }
int wombat_access_checker_harness(request_rec *r) { int lua_access_checker_harness(request_rec *r) {
return wombat_request_rec_hook_harness(r, "access_checker"); return lua_request_rec_hook_harness(r, "access_checker");
} }
int wombat_auth_checker_harness(request_rec *r) { int lua_auth_checker_harness(request_rec *r) {
return wombat_request_rec_hook_harness(r, "auth_checker"); return lua_request_rec_hook_harness(r, "auth_checker");
} }
void wombat_insert_filter_harness(request_rec *r) { void lua_insert_filter_harness(request_rec *r) {
/* ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, "LuaHookInsertFilter not yet implemented"); */ /* ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, "LuaHookInsertFilter not yet implemented"); */
} }
int wombat_quick_harness(request_rec *r, int lookup) { int lua_quick_harness(request_rec *r, int lookup) {
if(lookup) { if(lookup) {
return DECLINED; return DECLINED;
} }
return wombat_request_rec_hook_harness(r, "quick"); return lua_request_rec_hook_harness(r, "quick");
} }
static const char* register_translate_name_hook(cmd_parms *cmd, void *_cfg, const char *file, const char *function) { static const char* register_translate_name_hook(cmd_parms *cmd, void *_cfg, const char *file, const char *function) {
@@ -608,7 +608,7 @@ static const char* register_quick_block(cmd_parms *cmd, void *_cfg, const char *
static const char* register_package_helper(cmd_parms *cmd, const char *arg, apr_array_header_t *dir_array) { static const char* register_package_helper(cmd_parms *cmd, const char *arg, apr_array_header_t *dir_array) {
apr_status_t rv; apr_status_t rv;
apw_server_cfg *server_cfg = ap_get_module_config(cmd->server->module_config, &lua_module); apl_server_cfg *server_cfg = ap_get_module_config(cmd->server->module_config, &lua_module);
char *fixed_filename; char *fixed_filename;
rv = apr_filepath_merge(&fixed_filename, server_cfg->root_path, arg, APR_FILEPATH_NOTRELATIVE, cmd->pool); rv = apr_filepath_merge(&fixed_filename, server_cfg->root_path, arg, APR_FILEPATH_NOTRELATIVE, cmd->pool);
if (rv != APR_SUCCESS) { if (rv != APR_SUCCESS) {
@@ -625,7 +625,7 @@ static const char* register_package_helper(cmd_parms *cmd, const char *arg, apr_
* LuaPackagePath /lua/package/path/mapped/thing/like/this/?.lua * LuaPackagePath /lua/package/path/mapped/thing/like/this/?.lua
*/ */
const char* register_package_dir(cmd_parms *cmd, void *_cfg, const char *arg) { const char* register_package_dir(cmd_parms *cmd, void *_cfg, const char *arg) {
apw_dir_cfg* cfg = (apw_dir_cfg*)_cfg; apl_dir_cfg* cfg = (apl_dir_cfg*)_cfg;
return register_package_helper(cmd, arg, cfg->package_paths); return register_package_helper(cmd, arg, cfg->package_paths);
} }
@@ -635,7 +635,7 @@ const char* register_package_dir(cmd_parms *cmd, void *_cfg, const char *arg) {
* LuaPackageCPath /lua/package/path/mapped/thing/like/this/?.so * LuaPackageCPath /lua/package/path/mapped/thing/like/this/?.so
*/ */
const char* register_package_cdir(cmd_parms *cmd, void *_cfg, const char *arg) { const char* register_package_cdir(cmd_parms *cmd, void *_cfg, const char *arg) {
apw_dir_cfg* cfg = (apw_dir_cfg*)_cfg; apl_dir_cfg* cfg = (apl_dir_cfg*)_cfg;
return register_package_helper(cmd, arg, cfg->package_cpaths); return register_package_helper(cmd, arg, cfg->package_cpaths);
} }
@@ -645,15 +645,15 @@ const char* register_package_cdir(cmd_parms *cmd, void *_cfg, const char *arg) {
* LuaCodeCache * LuaCodeCache
*/ */
const char* register_code_cache(cmd_parms *cmd, void *_cfg, const char *arg) { const char* register_code_cache(cmd_parms *cmd, void *_cfg, const char *arg) {
apw_dir_cfg* cfg = (apw_dir_cfg*)_cfg; apl_dir_cfg* cfg = (apl_dir_cfg*)_cfg;
if (apr_strnatcmp("stat", arg) == 0) { if (apr_strnatcmp("stat", arg) == 0) {
cfg->code_cache_style = APW_CODE_CACHE_STAT; cfg->code_cache_style = APL_CODE_CACHE_STAT;
} }
else if (apr_strnatcmp("forever", arg) == 0) { else if (apr_strnatcmp("forever", arg) == 0) {
cfg->code_cache_style = APW_CODE_CACHE_FOREVER; cfg->code_cache_style = APL_CODE_CACHE_FOREVER;
} }
else if (apr_strnatcmp("never", arg) == 0) { else if (apr_strnatcmp("never", arg) == 0) {
cfg->code_cache_style = APW_CODE_CACHE_NEVER; cfg->code_cache_style = APL_CODE_CACHE_NEVER;
} }
else { else {
return apr_psprintf(cmd->pool, return apr_psprintf(cmd->pool,
@@ -666,18 +666,18 @@ const char* register_code_cache(cmd_parms *cmd, void *_cfg, const char *arg) {
static const char* register_lua_scope(cmd_parms *cmd, void *_cfg, const char *scope, static const char* register_lua_scope(cmd_parms *cmd, void *_cfg, const char *scope,
const char *min, const char *min,
const char *max) { const char *max) {
apw_dir_cfg* cfg = (apw_dir_cfg*)_cfg; apl_dir_cfg* cfg = (apl_dir_cfg*)_cfg;
if (apr_strnatcmp("once", scope) == 0) { if (apr_strnatcmp("once", scope) == 0) {
cfg->vm_scope = APW_SCOPE_ONCE; cfg->vm_scope = APL_SCOPE_ONCE;
} }
else if (apr_strnatcmp("request", scope) == 0) { else if (apr_strnatcmp("request", scope) == 0) {
cfg->vm_scope = APW_SCOPE_REQUEST; cfg->vm_scope = APL_SCOPE_REQUEST;
} }
else if (apr_strnatcmp("conn", scope) == 0) { else if (apr_strnatcmp("conn", scope) == 0) {
cfg->vm_scope = APW_SCOPE_CONN; cfg->vm_scope = APL_SCOPE_CONN;
} }
else if (apr_strnatcmp("server", scope) == 0) { else if (apr_strnatcmp("server", scope) == 0) {
cfg->vm_scope = APW_SCOPE_SERVER; cfg->vm_scope = APL_SCOPE_SERVER;
if (min) cfg->vm_server_pool_min = atoi(min); if (min) cfg->vm_server_pool_min = atoi(min);
if (max) cfg->vm_server_pool_max = atoi(max); if (max) cfg->vm_server_pool_max = atoi(max);
} }
@@ -695,12 +695,12 @@ static const char* register_lua_scope(cmd_parms *cmd, void *_cfg, const char *sc
* AddLuaHandler /alias /path/to/lua/file.lua [handler_function_name] * AddLuaHandler /alias /path/to/lua/file.lua [handler_function_name]
*/ */
static const char* lua_map_handler(cmd_parms *cmd, void *_cfg, const char *path, const char *file, const char *function) { static const char* lua_map_handler(cmd_parms *cmd, void *_cfg, const char *path, const char *file, const char *function) {
apw_dir_cfg* cfg = (apw_dir_cfg*)_cfg; apl_dir_cfg* cfg = (apl_dir_cfg*)_cfg;
const char *function_name; const char *function_name;
function_name = function ? function : "handle"; function_name = function ? function : "handle";
apr_status_t rv; apr_status_t rv;
rv = apw_lua_map_handler(cfg, file, function_name, path, "once"); rv = apl_lua_map_handler(cfg, file, function_name, path, "once");
if (rv != APR_SUCCESS) { if (rv != APR_SUCCESS) {
return apr_psprintf(cmd->pool, "Unable to configure a lua handler for path '%s', handler %s#%s", return apr_psprintf(cmd->pool, "Unable to configure a lua handler for path '%s', handler %s#%s",
path, file, function_name); path, file, function_name);
@@ -709,8 +709,8 @@ static const char* lua_map_handler(cmd_parms *cmd, void *_cfg, const char *path,
} }
static const char* register_lua_root(cmd_parms *cmd, void *_cfg, const char *root) { static const char* register_lua_root(cmd_parms *cmd, void *_cfg, const char *root) {
/* apw_dir_cfg* cfg = (apw_dir_cfg*)_cfg; */ /* apl_dir_cfg* cfg = (apl_dir_cfg*)_cfg; */
apw_server_cfg* cfg = ap_get_module_config(cmd->server->module_config, &lua_module); apl_server_cfg* cfg = ap_get_module_config(cmd->server->module_config, &lua_module);
cfg->root_path = root; cfg->root_path = root;
return NULL; return NULL;
@@ -718,10 +718,10 @@ static const char* register_lua_root(cmd_parms *cmd, void *_cfg, const char *roo
/*******************************/ /*******************************/
command_rec wombat_commands[] = { command_rec lua_commands[] = {
AP_INIT_TAKE1("LuaRoot", register_lua_root, NULL, OR_ALL, AP_INIT_TAKE1("LuaRoot", register_lua_root, NULL, OR_ALL,
"Specify the base path for resolving relative paths for mod_wombat directives"), "Specify the base path for resolving relative paths for mod_lua directives"),
AP_INIT_TAKE1("LuaPackagePath", register_package_dir, NULL, OR_ALL, AP_INIT_TAKE1("LuaPackagePath", register_package_dir, NULL, OR_ALL,
@@ -804,20 +804,20 @@ command_rec wombat_commands[] = {
static void* create_dir_config(apr_pool_t *p, char *dir) { static void* create_dir_config(apr_pool_t *p, char *dir) {
apw_dir_cfg* cfg = apr_pcalloc(p, sizeof(apw_dir_cfg)); apl_dir_cfg* cfg = apr_pcalloc(p, sizeof(apl_dir_cfg));
cfg->package_paths = apr_array_make(p, 2, sizeof(char*)); cfg->package_paths = apr_array_make(p, 2, sizeof(char*));
cfg->package_cpaths = apr_array_make(p, 2, sizeof(char*)); cfg->package_cpaths = apr_array_make(p, 2, sizeof(char*));
cfg->mapped_handlers = apr_array_make(p, 1, sizeof(apw_mapped_handler_spec*)); cfg->mapped_handlers = apr_array_make(p, 1, sizeof(apl_mapped_handler_spec*));
cfg->code_cache_style = APW_CODE_CACHE_STAT; cfg->code_cache_style = APL_CODE_CACHE_STAT;
cfg->pool = p; cfg->pool = p;
cfg->hooks = apr_hash_make(p); cfg->hooks = apr_hash_make(p);
cfg->dir = apr_pstrdup(p, dir); cfg->dir = apr_pstrdup(p, dir);
cfg->vm_scope = APW_SCOPE_ONCE; cfg->vm_scope = APL_SCOPE_ONCE;
return cfg; return cfg;
} }
static int create_request_config(request_rec *r) { static int create_request_config(request_rec *r) {
apw_request_cfg *cfg = apr_palloc(r->pool, sizeof(apw_request_cfg)); apl_request_cfg *cfg = apr_palloc(r->pool, sizeof(apl_request_cfg));
cfg->mapped_request_details = NULL; cfg->mapped_request_details = NULL;
cfg->request_scoped_vms = apr_hash_make(r->pool); cfg->request_scoped_vms = apr_hash_make(r->pool);
ap_set_module_config(r->request_config, &lua_module, cfg); ap_set_module_config(r->request_config, &lua_module, cfg);
@@ -826,8 +826,8 @@ static int create_request_config(request_rec *r) {
static void* create_server_config(apr_pool_t *p, server_rec *s) { static void* create_server_config(apr_pool_t *p, server_rec *s) {
apw_server_cfg *cfg = apr_pcalloc(p, sizeof(apw_server_cfg)); apl_server_cfg *cfg = apr_pcalloc(p, sizeof(apl_server_cfg));
cfg->code_cache = apr_pcalloc(p, sizeof(apw_code_cache)); cfg->code_cache = apr_pcalloc(p, sizeof(apl_code_cache));
apr_thread_rwlock_create(&cfg->code_cache->compiled_files_lock, p); apr_thread_rwlock_create(&cfg->code_cache->compiled_files_lock, p);
cfg->code_cache->compiled_files = apr_hash_make(p); cfg->code_cache->compiled_files = apr_hash_make(p);
cfg->vm_reslists = apr_hash_make(p); cfg->vm_reslists = apr_hash_make(p);
@@ -838,34 +838,34 @@ static void* create_server_config(apr_pool_t *p, server_rec *s) {
return cfg; return cfg;
} }
static int wombat_request_hook(lua_State *L, request_rec *r) { static int lua_request_hook(lua_State *L, request_rec *r) {
apw_push_request(L, r); apl_push_request(L, r);
return OK; return OK;
} }
static void wombat_register_hooks(apr_pool_t *p) { static void lua_register_hooks(apr_pool_t *p) {
/* ap_register_output_filter("wombathood", wombathood, NULL, AP_FTYPE_RESOURCE); */ /* ap_register_output_filter("luahood", luahood, NULL, AP_FTYPE_RESOURCE); */
ap_hook_handler(wombat_handler, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_handler(lua_handler, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_create_request(create_request_config, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_create_request(create_request_config, NULL, NULL, APR_HOOK_MIDDLE);
/* http_request.h hooks */ /* http_request.h hooks */
ap_hook_translate_name(wombat_translate_name_harness, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_translate_name(lua_translate_name_harness, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_fixups(wombat_fixup_harness, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_fixups(lua_fixup_harness, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_map_to_storage(wombat_map_to_storage_harness, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_map_to_storage(lua_map_to_storage_harness, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_check_user_id(wombat_check_user_id_harness, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_check_user_id(lua_check_user_id_harness, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_type_checker(wombat_type_checker_harness, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_type_checker(lua_type_checker_harness, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_access_checker(wombat_access_checker_harness, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_access_checker(lua_access_checker_harness, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_auth_checker(wombat_auth_checker_harness, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_auth_checker(lua_auth_checker_harness, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_insert_filter(wombat_insert_filter_harness, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_insert_filter(lua_insert_filter_harness, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_quick_handler(wombat_quick_harness, NULL, NULL, APR_HOOK_FIRST); ap_hook_quick_handler(lua_quick_harness, NULL, NULL, APR_HOOK_FIRST);
/* ap_hook_translate_name(wombat_alias_munger, NULL, NULL, APR_HOOK_MIDDLE); */ /* ap_hook_translate_name(lua_alias_munger, NULL, NULL, APR_HOOK_MIDDLE); */
ap_hook_translate_name(apw_alias_munger, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_translate_name(apl_alias_munger, NULL, NULL, APR_HOOK_MIDDLE);
APR_OPTIONAL_HOOK(apw, wombat_open, wombat_open_hook, NULL, NULL, APR_OPTIONAL_HOOK(apl, lua_open, lua_open_hook, NULL, NULL,
APR_HOOK_REALLY_FIRST); APR_HOOK_REALLY_FIRST);
APR_OPTIONAL_HOOK(apw, wombat_request, wombat_request_hook, NULL, NULL, APR_OPTIONAL_HOOK(apl, lua_request, lua_request_hook, NULL, NULL,
APR_HOOK_REALLY_FIRST); APR_HOOK_REALLY_FIRST);
} }
@@ -875,7 +875,7 @@ module AP_MODULE_DECLARE_DATA lua_module = {
NULL, /* merge per-dir config structures */ NULL, /* merge per-dir config structures */
create_server_config, /* create per-server config structures */ create_server_config, /* create per-server config structures */
NULL, /* merge per-server config structures */ NULL, /* merge per-server config structures */
wombat_commands, /* table of config file commands */ lua_commands, /* table of config file commands */
wombat_register_hooks /* register hooks */ lua_register_hooks /* register hooks */
}; };

View File

@@ -76,7 +76,7 @@ typedef struct {
unsigned int code_cache_style; unsigned int code_cache_style;
/** /**
* APW_SCOPE_ONCE | APW_SCOPE_REQUEST | APW_SCOPE_CONN | APW_SCOPE_SERVER * APL_SCOPE_ONCE | APL_SCOPE_REQUEST | APL_SCOPE_CONN | APL_SCOPE_SERVER
*/ */
unsigned int vm_scope; unsigned int vm_scope;
unsigned int vm_server_pool_min; unsigned int vm_server_pool_min;
@@ -87,56 +87,56 @@ typedef struct {
/* the actual directory being configured */ /* the actual directory being configured */
char *dir; char *dir;
} apw_dir_cfg; } apl_dir_cfg;
typedef struct { typedef struct {
apw_code_cache *code_cache; apl_code_cache *code_cache;
apr_hash_t *vm_reslists; apr_hash_t *vm_reslists;
apr_thread_rwlock_t *vm_reslists_lock; apr_thread_rwlock_t *vm_reslists_lock;
/* value of the LuaRoot directive */ /* value of the LuaRoot directive */
const char *root_path; const char *root_path;
} apw_server_cfg; } apl_server_cfg;
typedef struct { typedef struct {
char *function_name; char *function_name;
apw_vm_spec *spec; apl_vm_spec *spec;
} mapped_request_details; } mapped_request_details;
typedef struct { typedef struct {
mapped_request_details *mapped_request_details; mapped_request_details *mapped_request_details;
apr_hash_t *request_scoped_vms; apr_hash_t *request_scoped_vms;
} apw_request_cfg; } apl_request_cfg;
typedef struct { typedef struct {
lua_State *L; lua_State *L;
char *function; char *function;
} apw_filter_ctx; } apl_filter_ctx;
extern module AP_MODULE_DECLARE_DATA lua_module; extern module AP_MODULE_DECLARE_DATA lua_module;
#if !defined(WIN32) #if !defined(WIN32)
#define WOMBAT_DECLARE(type) type #define AP_LUA_DECLARE(type) type
#define WOMBAT_DECLARE_NONSTD(type) type #define AP_LUA_DECLARE_NONSTD(type) type
#define WOMBAT_DECLARE_DATA #define AP_LUA_DECLARE_DATA
#elif defined(WOMBAT_DECLARE_STATIC) #elif defined(LUA_DECLARE_STATIC)
#define WOMBAT_DECLARE(type) type __stdcall #define AP_LUA_DECLARE(type) type __stdcall
#define WOMBAT_DECLARE_NONSTD(type) type #define AP_LUA_DECLARE_NONSTD(type) type
#define WOMBAT_DECLARE_DATA #define AP_LUA_DECLARE_DATA
#elif defined(WOMBAT_DECLARE_EXPORT) #elif defined(LUA_DECLARE_EXPORT)
#define WOMBAT_DECLARE(type) __declspec(dllexport) type __stdcall #define AP_LUA_DECLARE(type) __declspec(dllexport) type __stdcall
#define WOMBAT_DECLARE_NONSTD(type) __declspec(dllexport) type #define AP_LUA_DECLARE_NONSTD(type) __declspec(dllexport) type
#define WOMBAT_DECLARE_DATA __declspec(dllexport) #define AP_LUA_DECLARE_DATA __declspec(dllexport)
#else #else
#define WOMBAT_DECLARE(type) __declspec(dllimport) type __stdcall #define AP_LUA_DECLARE(type) __declspec(dllimport) type __stdcall
#define WOMBAT_DECLARE_NONSTD(type) __declspec(dllimport) type #define AP_LUA_DECLARE_NONSTD(type) __declspec(dllimport) type
#define WOMBAT_DECLARE_DATA __declspec(dllimport) #define AP_LUA_DECLARE_DATA __declspec(dllimport)
#endif #endif
APR_DECLARE_EXTERNAL_HOOK(apw, WOMBAT, int, wombat_open, APR_DECLARE_EXTERNAL_HOOK(apl, AP_LUA, int, lua_open,
(lua_State *L, apr_pool_t *p)); (lua_State *L, apr_pool_t *p));
APR_DECLARE_EXTERNAL_HOOK(apw, WOMBAT, int, wombat_request, APR_DECLARE_EXTERNAL_HOOK(apl, AP_LUA, int, lua_request,
(lua_State *L, request_rec *r)); (lua_State *L, request_rec *r));
#endif /* !_MOD_LUA_H_ */ #endif /* !_MOD_LUA_H_ */

View File

@@ -87,7 +87,7 @@ void rstack_dump(lua_State* L, request_rec* r, const char* msg) {
* userdata thingamajig and return it if it is. if it is not * userdata thingamajig and return it if it is. if it is not
* lua will enter its error handling routine. * lua will enter its error handling routine.
*/ */
static request_rec* apw_check_request_rec(lua_State* L, int index) { static request_rec* apl_check_request_rec(lua_State* L, int index) {
luaL_checkudata(L, index, "Apache2.Request"); luaL_checkudata(L, index, "Apache2.Request");
request_rec* r = (request_rec*)lua_unboxpointer(L, index); request_rec* r = (request_rec*)lua_unboxpointer(L, index);
return r; return r;
@@ -139,7 +139,7 @@ static int req_aprtable2luatable_cb(void *l, const char *key, const char *value)
/* r:parseargs() returning a lua table */ /* r:parseargs() returning a lua table */
static int req_parseargs(lua_State* L) { static int req_parseargs(lua_State* L) {
request_rec* r = apw_check_request_rec(L, 1); request_rec* r = apl_check_request_rec(L, 1);
lua_newtable(L); lua_newtable(L);
lua_newtable(L); /* [table, table] */ lua_newtable(L); /* [table, table] */
apr_table_t* form_table; apr_table_t* form_table;
@@ -150,7 +150,7 @@ static int req_parseargs(lua_State* L) {
/* wrap ap_rputs as r:puts(String) */ /* wrap ap_rputs as r:puts(String) */
static int req_puts(lua_State* L) { static int req_puts(lua_State* L) {
request_rec* r = apw_check_request_rec(L, 1); request_rec* r = apl_check_request_rec(L, 1);
int argc = lua_gettop(L); int argc = lua_gettop(L);
int i; int i;
@@ -163,7 +163,7 @@ static int req_puts(lua_State* L) {
/* wrap ap_rwrite as r:write(String) */ /* wrap ap_rwrite as r:write(String) */
static int req_write(lua_State* L) { static int req_write(lua_State* L) {
request_rec* r = apw_check_request_rec(L, 1); request_rec* r = apl_check_request_rec(L, 1);
size_t n; size_t n;
const char* buf = luaL_checklstring(L, 2, &n); const char* buf = luaL_checklstring(L, 2, &n);
@@ -173,7 +173,7 @@ static int req_write(lua_State* L) {
/* r:parsebody() */ /* r:parsebody() */
static int req_parsebody(lua_State* L) { static int req_parsebody(lua_State* L) {
request_rec* r = apw_check_request_rec(L, 1); request_rec* r = apl_check_request_rec(L, 1);
lua_newtable(L); lua_newtable(L);
lua_newtable(L); lua_newtable(L);
apr_table_t* form_table; apr_table_t* form_table;
@@ -185,7 +185,7 @@ static int req_parsebody(lua_State* L) {
/* r:addoutputfilter(name|function) */ /* r:addoutputfilter(name|function) */
static int req_add_output_filter(lua_State *L) { static int req_add_output_filter(lua_State *L) {
request_rec* r = apw_check_request_rec(L, 1); request_rec* r = apl_check_request_rec(L, 1);
const char *name = luaL_checkstring(L, 2); const char *name = luaL_checkstring(L, 2);
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "adding output filter %s", name); ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "adding output filter %s", name);
ap_add_output_filter(name, L, r, r->connection); ap_add_output_filter(name, L, r, r->connection);
@@ -193,7 +193,7 @@ static int req_add_output_filter(lua_State *L) {
} }
static int req_document_root(lua_State* L) { static int req_document_root(lua_State* L) {
request_rec* r = apw_check_request_rec(L, 1); request_rec* r = apl_check_request_rec(L, 1);
char* doc_root = apr_pstrdup(r->pool, ap_document_root(r)); char* doc_root = apr_pstrdup(r->pool, ap_document_root(r));
lua_pushstring(L, doc_root); lua_pushstring(L, doc_root);
return 1; return 1;
@@ -272,7 +272,7 @@ static int req_assbackwards_field(request_rec* r) {
/* END dispatch mathods for request_rec fields */ /* END dispatch mathods for request_rec fields */
static int req_dispatch(lua_State* L) { static int req_dispatch(lua_State* L) {
request_rec* r = apw_check_request_rec(L, 1); request_rec* r = apl_check_request_rec(L, 1);
const char *name = luaL_checkstring(L, 2); const char *name = luaL_checkstring(L, 2);
lua_pop(L, 2); lua_pop(L, 2);
@@ -283,20 +283,20 @@ static int req_dispatch(lua_State* L) {
req_fun_t* rft = apr_hash_get(dispatch, name, APR_HASH_KEY_STRING); req_fun_t* rft = apr_hash_get(dispatch, name, APR_HASH_KEY_STRING);
if (rft) { if (rft) {
switch(rft->type) { switch(rft->type) {
case APW_REQ_FUNTYPE_TABLE: { case APL_REQ_FUNTYPE_TABLE: {
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
"request_rec->dispatching %s -> apr table (NOT IMPLEMENTED YET)", name); "request_rec->dispatching %s -> apr table (NOT IMPLEMENTED YET)", name);
return 0; return 0;
} }
case APW_REQ_FUNTYPE_LUACFUN: { case APL_REQ_FUNTYPE_LUACFUN: {
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
"request_rec->dispatching %s -> lua_CFunction", name); "request_rec->dispatching %s -> lua_CFunction", name);
lua_CFunction func = rft->fun; lua_CFunction func = rft->fun;
lua_pushcfunction(L, func); lua_pushcfunction(L, func);
return 1; return 1;
} }
case APW_REQ_FUNTYPE_STRING: { case APL_REQ_FUNTYPE_STRING: {
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
"request_rec->dispatching %s -> string", name); "request_rec->dispatching %s -> string", name);
req_field_string_f func = rft->fun; req_field_string_f func = rft->fun;
@@ -304,7 +304,7 @@ static int req_dispatch(lua_State* L) {
lua_pushstring(L, rs); lua_pushstring(L, rs);
return 1; return 1;
} }
case APW_REQ_FUNTYPE_INT: { case APL_REQ_FUNTYPE_INT: {
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
"request_rec->dispatching %s -> int", name); "request_rec->dispatching %s -> int", name);
req_field_int_f func = rft->fun; req_field_int_f func = rft->fun;
@@ -312,7 +312,7 @@ static int req_dispatch(lua_State* L) {
lua_pushnumber(L, rs); lua_pushnumber(L, rs);
return 1; return 1;
} }
case APW_REQ_FUNTYPE_BOOLEAN: { case APL_REQ_FUNTYPE_BOOLEAN: {
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
"request_rec->dispatching %s -> boolean", name); "request_rec->dispatching %s -> boolean", name);
req_field_int_f func = rft->fun; req_field_int_f func = rft->fun;
@@ -330,7 +330,7 @@ static int req_dispatch(lua_State* L) {
/* helper function for the logging functions below */ /* helper function for the logging functions below */
static int req_log_at(lua_State* L, int level) { static int req_log_at(lua_State* L, int level) {
request_rec* r = apw_check_request_rec(L, 1); request_rec* r = apl_check_request_rec(L, 1);
lua_Debug dbg; lua_Debug dbg;
lua_getstack(L, 1, &dbg); lua_getstack(L, 1, &dbg);
@@ -355,7 +355,7 @@ static int req_debug(lua_State* L) { req_log_at(L, APLOG_DEBUG); return 0; }
static int req_newindex(lua_State* L) { static int req_newindex(lua_State* L) {
/* request_rec* r = lua_touserdata(L, lua_upvalueindex(1)); */ /* request_rec* r = lua_touserdata(L, lua_upvalueindex(1)); */
/* const char* key = luaL_checkstring(L, -2); */ /* const char* key = luaL_checkstring(L, -2); */
request_rec* r = apw_check_request_rec(L, 1); request_rec* r = apl_check_request_rec(L, 1);
rstack_dump(L, r, "req_newindex"); rstack_dump(L, r, "req_newindex");
const char *key = luaL_checkstring(L, 2); const char *key = luaL_checkstring(L, 2);
rstack_dump(L, r, "req_newindex"); rstack_dump(L, r, "req_newindex");
@@ -429,72 +429,72 @@ static req_fun_t* makefun(void* fun, int type, apr_pool_t* pool) {
return rft; return rft;
} }
void apw_load_request_lmodule(lua_State *L, apr_pool_t *p) { void apl_load_request_lmodule(lua_State *L, apr_pool_t *p) {
apr_hash_t* dispatch = apr_hash_make(p); apr_hash_t* dispatch = apr_hash_make(p);
apr_hash_set(dispatch, "puts", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "puts", APR_HASH_KEY_STRING,
makefun(&req_puts, APW_REQ_FUNTYPE_LUACFUN, p)); makefun(&req_puts, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "write", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "write", APR_HASH_KEY_STRING,
makefun(&req_write, APW_REQ_FUNTYPE_LUACFUN, p)); makefun(&req_write, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "document_root", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "document_root", APR_HASH_KEY_STRING,
makefun(&req_document_root, APW_REQ_FUNTYPE_LUACFUN, p)); makefun(&req_document_root, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "parseargs", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "parseargs", APR_HASH_KEY_STRING,
makefun(&req_parseargs, APW_REQ_FUNTYPE_LUACFUN, p)); makefun(&req_parseargs, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "parsebody", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "parsebody", APR_HASH_KEY_STRING,
makefun(&req_parsebody, APW_REQ_FUNTYPE_LUACFUN, p)); makefun(&req_parsebody, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "debug", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "debug", APR_HASH_KEY_STRING,
makefun(&req_debug, APW_REQ_FUNTYPE_LUACFUN, p)); makefun(&req_debug, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "info", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "info", APR_HASH_KEY_STRING,
makefun(&req_info, APW_REQ_FUNTYPE_LUACFUN, p)); makefun(&req_info, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "notice", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "notice", APR_HASH_KEY_STRING,
makefun(&req_notice, APW_REQ_FUNTYPE_LUACFUN, p)); makefun(&req_notice, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "warn", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "warn", APR_HASH_KEY_STRING,
makefun(req_warn, APW_REQ_FUNTYPE_LUACFUN, p)); makefun(req_warn, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "err", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "err", APR_HASH_KEY_STRING,
makefun(&req_err, APW_REQ_FUNTYPE_LUACFUN, p)); makefun(&req_err, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "crit", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "crit", APR_HASH_KEY_STRING,
makefun(&req_crit, APW_REQ_FUNTYPE_LUACFUN, p)); makefun(&req_crit, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "alert", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "alert", APR_HASH_KEY_STRING,
makefun(&req_alert, APW_REQ_FUNTYPE_LUACFUN, p)); makefun(&req_alert, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "emerg", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "emerg", APR_HASH_KEY_STRING,
makefun(&req_emerg, APW_REQ_FUNTYPE_LUACFUN, p)); makefun(&req_emerg, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "add_output_filter", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "add_output_filter", APR_HASH_KEY_STRING,
makefun(&req_add_output_filter, APW_REQ_FUNTYPE_LUACFUN, p)); makefun(&req_add_output_filter, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "assbackwards", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "assbackwards", APR_HASH_KEY_STRING,
makefun(&req_assbackwards_field, APW_REQ_FUNTYPE_BOOLEAN, p)); makefun(&req_assbackwards_field, APL_REQ_FUNTYPE_BOOLEAN, p));
apr_hash_set(dispatch, "status", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "status", APR_HASH_KEY_STRING,
makefun(&req_status_field, APW_REQ_FUNTYPE_INT, p)); makefun(&req_status_field, APL_REQ_FUNTYPE_INT, p));
apr_hash_set(dispatch, "protocol", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "protocol", APR_HASH_KEY_STRING,
makefun(&req_protocol_field, APW_REQ_FUNTYPE_STRING, p)); makefun(&req_protocol_field, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "range", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "range", APR_HASH_KEY_STRING,
makefun(&req_range_field, APW_REQ_FUNTYPE_STRING, p)); makefun(&req_range_field, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "content_type", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "content_type", APR_HASH_KEY_STRING,
makefun(&req_content_type_field, APW_REQ_FUNTYPE_STRING, p)); makefun(&req_content_type_field, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "content_encoding", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "content_encoding", APR_HASH_KEY_STRING,
makefun(&req_content_encoding_field, APW_REQ_FUNTYPE_STRING, p)); makefun(&req_content_encoding_field, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "ap_auth_type", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "ap_auth_type", APR_HASH_KEY_STRING,
makefun(&req_ap_auth_type_field, APW_REQ_FUNTYPE_STRING, p)); makefun(&req_ap_auth_type_field, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "unparsed_uri", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "unparsed_uri", APR_HASH_KEY_STRING,
makefun(&req_unparsed_uri_field, APW_REQ_FUNTYPE_STRING, p)); makefun(&req_unparsed_uri_field, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "user", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "user", APR_HASH_KEY_STRING,
makefun(&req_user_field, APW_REQ_FUNTYPE_STRING, p)); makefun(&req_user_field, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "filename", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "filename", APR_HASH_KEY_STRING,
makefun(&req_filename_field, APW_REQ_FUNTYPE_STRING, p)); makefun(&req_filename_field, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "canonical_filename", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "canonical_filename", APR_HASH_KEY_STRING,
makefun(&req_canonical_filename_field, APW_REQ_FUNTYPE_STRING, p)); makefun(&req_canonical_filename_field, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "path_info", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "path_info", APR_HASH_KEY_STRING,
makefun(&req_path_info_field, APW_REQ_FUNTYPE_STRING, p)); makefun(&req_path_info_field, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "args", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "args", APR_HASH_KEY_STRING,
makefun(&req_args_field, APW_REQ_FUNTYPE_STRING, p)); makefun(&req_args_field, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "hostname", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "hostname", APR_HASH_KEY_STRING,
makefun(&req_hostname_field, APW_REQ_FUNTYPE_STRING, p)); makefun(&req_hostname_field, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "uri", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "uri", APR_HASH_KEY_STRING,
makefun(&req_uri_field, APW_REQ_FUNTYPE_STRING, p)); makefun(&req_uri_field, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "the_request", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "the_request", APR_HASH_KEY_STRING,
makefun(&req_the_request_field, APW_REQ_FUNTYPE_STRING, p)); makefun(&req_the_request_field, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "method", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "method", APR_HASH_KEY_STRING,
makefun(&req_method_field, APW_REQ_FUNTYPE_STRING, p)); makefun(&req_method_field, APL_REQ_FUNTYPE_STRING, p));
lua_pushlightuserdata(L, dispatch); lua_pushlightuserdata(L, dispatch);
lua_setfield(L, LUA_REGISTRYINDEX, "Apache2.Request.dispatch"); lua_setfield(L, LUA_REGISTRYINDEX, "Apache2.Request.dispatch");
@@ -525,13 +525,13 @@ void apw_load_request_lmodule(lua_State *L, apr_pool_t *p) {
} }
void apw_push_connection(lua_State* L, conn_rec* c) { void apl_push_connection(lua_State* L, conn_rec* c) {
lua_boxpointer(L, c); lua_boxpointer(L, c);
luaL_getmetatable(L, "Apache2.Connection"); luaL_getmetatable(L, "Apache2.Connection");
lua_setmetatable(L, -2); lua_setmetatable(L, -2);
luaL_getmetatable(L, "Apache2.Connection"); luaL_getmetatable(L, "Apache2.Connection");
apw_push_apr_table(L, "notes", c->notes); apl_push_apr_table(L, "notes", c->notes);
lua_pushstring(L, c->remote_ip); lua_pushstring(L, c->remote_ip);
lua_setfield(L, -2, "remote_ip"); lua_setfield(L, -2, "remote_ip");
@@ -540,7 +540,7 @@ void apw_push_connection(lua_State* L, conn_rec* c) {
} }
void apw_push_server(lua_State* L, server_rec* s) { void apl_push_server(lua_State* L, server_rec* s) {
lua_boxpointer(L, s); lua_boxpointer(L, s);
luaL_getmetatable(L, "Apache2.Server"); luaL_getmetatable(L, "Apache2.Server");
lua_setmetatable(L, -2); lua_setmetatable(L, -2);
@@ -552,7 +552,7 @@ void apw_push_server(lua_State* L, server_rec* s) {
lua_pop(L, 1); lua_pop(L, 1);
} }
void apw_push_request(lua_State* L, request_rec* r) { void apl_push_request(lua_State* L, request_rec* r) {
lua_boxpointer(L, r); lua_boxpointer(L, r);
luaL_getmetatable(L, "Apache2.Request"); luaL_getmetatable(L, "Apache2.Request");
lua_setmetatable(L, -2); lua_setmetatable(L, -2);

View File

@@ -18,14 +18,14 @@
#ifndef REQUEST_H #ifndef REQUEST_H
#define REQUEST_H #define REQUEST_H
APR_DECLARE(void) apw_push_request(lua_State* L, request_rec* r); APR_DECLARE(void) apl_push_request(lua_State* L, request_rec* r);
APR_DECLARE(void) apw_load_request_lmodule(lua_State *L, apr_pool_t *p); APR_DECLARE(void) apl_load_request_lmodule(lua_State *L, apr_pool_t *p);
#define APW_REQ_FUNTYPE_STRING 1 #define APL_REQ_FUNTYPE_STRING 1
#define APW_REQ_FUNTYPE_INT 2 #define APL_REQ_FUNTYPE_INT 2
#define APW_REQ_FUNTYPE_TABLE 3 #define APL_REQ_FUNTYPE_TABLE 3
#define APW_REQ_FUNTYPE_LUACFUN 4 #define APL_REQ_FUNTYPE_LUACFUN 4
#define APW_REQ_FUNTYPE_BOOLEAN 5 #define APL_REQ_FUNTYPE_BOOLEAN 5
typedef struct { typedef struct {
void *fun; void *fun;

View File

@@ -93,7 +93,7 @@ static void pstack_dump(lua_State* L, apr_pool_t* r, int level, const char* msg)
/* BEGIN apache lmodule */ /* BEGIN apache lmodule */
void apw_load_apache2_lmodule(lua_State *L) { void apl_load_apache2_lmodule(lua_State *L) {
lua_getglobal(L, "package"); lua_getglobal(L, "package");
lua_getfield(L, -1, "loaded"); lua_getfield(L, -1, "loaded");
lua_newtable(L); lua_newtable(L);
@@ -256,11 +256,11 @@ static void munge_path(lua_State *L,
lua_pop(L, 1); /* pop "package" off the stack */ lua_pop(L, 1); /* pop "package" off the stack */
} }
lua_State* apw_get_lua_state(apr_pool_t* lifecycle_pool, lua_State* apl_get_lua_state(apr_pool_t* lifecycle_pool,
char* file, char* file,
apr_array_header_t* package_paths, apr_array_header_t* package_paths,
apr_array_header_t* package_cpaths, apr_array_header_t* package_cpaths,
apw_lua_state_open_callback cb, apl_lua_state_open_callback cb,
void* btn) { void* btn) {
lua_State* L; lua_State* L;

View File

@@ -34,14 +34,14 @@
#ifndef VMPREP_H #ifndef VMPREP_H
#define VMPREP_H #define VMPREP_H
#define APW_CODE_CACHE_STAT 1 #define APL_CODE_CACHE_STAT 1
#define APW_CODE_CACHE_FOREVER 2 #define APL_CODE_CACHE_FOREVER 2
#define APW_CODE_CACHE_NEVER 3 #define APL_CODE_CACHE_NEVER 3
#define APW_SCOPE_ONCE 1 #define APL_SCOPE_ONCE 1
#define APW_SCOPE_REQUEST 2 #define APL_SCOPE_REQUEST 2
#define APW_SCOPE_CONN 3 #define APL_SCOPE_CONN 3
#define APW_SCOPE_SERVER 4 #define APL_SCOPE_SERVER 4
/** /**
* Specification for a lua virtual machine * Specification for a lua virtual machine
@@ -55,18 +55,18 @@ typedef struct {
/* name of base file to load in the vm */ /* name of base file to load in the vm */
char *file; char *file;
/* APW_CODE_CACHE_STAT | APW_CODE_CACHE_FOREVER | APW_CODE_CACHE_NEVER */ /* APL_CODE_CACHE_STAT | APL_CODE_CACHE_FOREVER | APL_CODE_CACHE_NEVER */
int code_cache_style; int code_cache_style;
/* APW_SCOPE_ONCE | APW_SCOPE_REQUEST | APW_SCOPE_CONN | APW_SCOPE_SERVER */ /* APL_SCOPE_ONCE | APL_SCOPE_REQUEST | APL_SCOPE_CONN | APL_SCOPE_SERVER */
int scope; int scope;
/* pool to use for lifecycle if APW_SCOPE_ONCE is set, otherwise unused */ /* pool to use for lifecycle if APL_SCOPE_ONCE is set, otherwise unused */
apr_pool_t *pool; apr_pool_t *pool;
const char *bytecode; const char *bytecode;
apr_size_t bytecode_len; apr_size_t bytecode_len;
} apw_vm_spec; } apl_vm_spec;
typedef struct { typedef struct {
int code_cache_style; int code_cache_style;
@@ -76,39 +76,39 @@ typedef struct {
ap_regex_t *uri_pattern; ap_regex_t *uri_pattern;
const char *bytecode; const char *bytecode;
apr_size_t bytecode_len; apr_size_t bytecode_len;
} apw_mapped_handler_spec; } apl_mapped_handler_spec;
typedef struct { typedef struct {
apr_pool_t *pool; apr_pool_t *pool;
apr_hash_t *compiled_files; apr_hash_t *compiled_files;
apr_thread_rwlock_t* compiled_files_lock; apr_thread_rwlock_t* compiled_files_lock;
} apw_code_cache; } apl_code_cache;
/* remove and make static once out of mod_wombat.c */ /* remove and make static once out of mod_wombat.c */
void apw_openlibs(lua_State* L); void apl_openlibs(lua_State* L);
/* remove and make static once out of mod_wombat.c */ /* remove and make static once out of mod_wombat.c */
void apw_registerlib(lua_State* L, char* name, lua_CFunction f); void apl_registerlib(lua_State* L, char* name, lua_CFunction f);
/** /**
* Fake out addition of the "apache2" module * Fake out addition of the "apache2" module
*/ */
void apw_load_apache2_lmodule(lua_State *L); void apl_load_apache2_lmodule(lua_State *L);
/** /**
* the apw_?getvm family of functions is used to create and/or obtain * the apl_?getvm family of functions is used to create and/or obtain
* a handle to a lua state. If there is not an extant vm matching the * a handle to a lua state. If there is not an extant vm matching the
* spec then a new one is created. * spec then a new one is created.
*/ */
/* lua_State* apw_rgetvm(request_rec *r, apw_vm_spec *spec); */ /* lua_State* apl_rgetvm(request_rec *r, apl_vm_spec *spec); */
/* returns NULL if the spec requires a request scope */ /* returns NULL if the spec requires a request scope */
/* lua_State* apw_cgetvm(conn_rec *r, apw_vm_spec *spec);*/ /* lua_State* apl_cgetvm(conn_rec *r, apl_vm_spec *spec);*/
/* returns NULL if the spec requires a request scope or conn scope */ /* returns NULL if the spec requires a request scope or conn scope */
/* lua_State* apw_sgetvm(server_rec *r, apw_vm_spec *spec); */ /* lua_State* apl_sgetvm(server_rec *r, apl_vm_spec *spec); */
typedef void (*apw_lua_state_open_callback) (lua_State* L, apr_pool_t* p, void* ctx); typedef void (*apl_lua_state_open_callback) (lua_State* L, apr_pool_t* p, void* ctx);
/* /*
* alternate means of getting lua_State (preferred eventually) * alternate means of getting lua_State (preferred eventually)
@@ -122,11 +122,11 @@ typedef void (*apw_lua_state_open_callback) (lua_State* L, apr_pool_t* p, void*
* @cb callback for vm initialization called *before* the file is opened * @cb callback for vm initialization called *before* the file is opened
* @ctx a baton passed to cb * @ctx a baton passed to cb
*/ */
lua_State* apw_get_lua_state(apr_pool_t* lifecycle_pool, lua_State* apl_get_lua_state(apr_pool_t* lifecycle_pool,
char* file, char* file,
apr_array_header_t* package_paths, apr_array_header_t* package_paths,
apr_array_header_t* package_cpaths, apr_array_header_t* package_cpaths,
apw_lua_state_open_callback cb, apl_lua_state_open_callback cb,
void* btn); void* btn);