Loading CHANGES +4 −0 Original line number Diff line number Diff line -*- coding: utf-8 -*- Changes with Apache 2.3.16 *) mod_lua: Stop losing track of all but the most specific LuaHook* directives when multiple per-directory config sections are used. Adds LuaInherit directive to control how parent sections are merged. [Eric Covener] *) mod_cache: Make sure we merge headers correctly when we handle a non cacheable conditional response. PR52120. [Graham Leggett] Loading docs/manual/mod/mod_lua.html.en +21 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ at any time.</div> <li><img alt="" src="../images/down.gif" /> <a href="#luahookmaptostorage">LuaHookMapToStorage</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#luahooktranslatename">LuaHookTranslateName</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#luahooktypechecker">LuaHookTypeChecker</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#luainherit">LuaInherit</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#luamaphandler">LuaMapHandler</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#luapackagecpath">LuaPackageCPath</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#luapackagepath">LuaPackagePath</a></li> Loading Loading @@ -630,6 +631,26 @@ end </table><p>...</p> </div> <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> <div class="directive-section"><h2><a name="LuaInherit" id="LuaInherit">LuaInherit</a> <a name="luainherit" id="luainherit">Directive</a></h2> <table class="directive"> <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Controls how parent configuration sections are merged into children</td></tr> <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LuaInherit none|parent-first|parent-last</code></td></tr> <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LuaInherit parent-first</code></td></tr> <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr> <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr> <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Experimental</td></tr> <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_lua</td></tr> <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>2.5.0 and later</td></tr> </table><p>By default, if LuaHook* directives are used in overlapping Directory or Location configuration sections, the scripts defined in the more specific section are run <em>after</em> those defined in the more generic section (LuaInherit parent-first). You can reverse this order, or make the parent context not apply at all.</p> <p> In previous 2.3.x releases, the default was effectively to ignore LuaHook* directives from parent configuration sections.</p> </div> <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> <div class="directive-section"><h2><a name="LuaMapHandler" id="LuaMapHandler">LuaMapHandler</a> <a name="luamaphandler" id="luamaphandler">Directive</a></h2> <table class="directive"> <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Map a path to a lua handler</td></tr> Loading docs/manual/mod/mod_lua.xml +20 −0 Original line number Diff line number Diff line Loading @@ -725,6 +725,26 @@ hook function usually returns OK, DECLINED, or HTTP_FORBIDDEN.</p> <usage><p>Not Yet Implemented</p></usage> </directivesynopsis> <directivesynopsis> <name>LuaInherit</name> <description>Controls how parent configuration sections are merged into children</description> <syntax>LuaInherit none|parent-first|parent-last</syntax> <default>LuaInherit parent-first</default> <compatibility>2.5.0 and later</compatibility> <contextlist><context>server config</context><context>virtual host</context> <context>directory</context><context>.htaccess</context> </contextlist> <override>All</override> <usage><p>By default, if LuaHook* directives are used in overlapping Directory or Location configuration sections, the scripts defined in the more specific section are run <em>after</em> those defined in the more generic section (LuaInherit parent-first). You can reverse this order, or make the parent context not apply at all.</p> <p> In previous 2.3.x releases, the default was effectively to ignore LuaHook* directives from parent configuration sections.</p></usage> </directivesynopsis> <directivesynopsis> <name>LuaQuickHandler</name> <description>Provide a hook for the quick handler of request processing</description> Loading modules/lua/lua_vmprep.h +1 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ #ifndef VMPREP_H #define VMPREP_H #define AP_LUA_SCOPE_UNSET 0 #define AP_LUA_SCOPE_ONCE 1 #define AP_LUA_SCOPE_REQUEST 2 #define AP_LUA_SCOPE_CONN 3 Loading modules/lua/mod_lua.c +87 −5 Original line number Diff line number Diff line Loading @@ -115,8 +115,9 @@ static int lua_handler(request_rec *r) spec->file, "handle"); switch (dcfg->vm_scope) { switch (spec->scope) { case AP_LUA_SCOPE_ONCE: case AP_LUA_SCOPE_UNSET: apr_pool_create(&pool, r->pool); break; case AP_LUA_SCOPE_REQUEST: Loading Loading @@ -190,7 +191,7 @@ static int lua_request_rec_hook_harness(request_rec *r, const char *name, int ap spec = apr_pcalloc(r->pool, sizeof(ap_lua_vm_spec)); spec->file = hook_spec->file_name; spec->scope = hook_spec->scope; spec->scope = cfg->vm_scope; spec->bytecode = hook_spec->bytecode; spec->bytecode_len = hook_spec->bytecode_len; spec->pool = r->pool; Loading @@ -210,6 +211,7 @@ static int lua_request_rec_hook_harness(request_rec *r, const char *name, int ap switch (spec->scope) { case AP_LUA_SCOPE_ONCE: case AP_LUA_SCOPE_UNSET: apr_pool_create(&pool, r->pool); break; case AP_LUA_SCOPE_REQUEST: Loading Loading @@ -864,7 +866,29 @@ static const char *register_package_cdir(cmd_parms *cmd, return register_package_helper(cmd, arg, cfg->package_cpaths); } static const char *register_lua_inherit(cmd_parms *cmd, void *_cfg, const char *arg) { ap_lua_dir_cfg *cfg = (ap_lua_dir_cfg *) _cfg; if (strcasecmp("none", arg) == 0) { cfg->inherit = AP_LUA_INHERIT_NONE; } else if (strcasecmp("parent-first", arg) == 0) { cfg->inherit = AP_LUA_INHERIT_PARENT_FIRST; } else if (strcasecmp("parent-last", arg) == 0) { cfg->inherit = AP_LUA_INHERIT_PARENT_LAST; } else { return apr_psprintf(cmd->pool, "LuaInherit type of '%s' not recognized, valid " "options are 'none', 'parent-first', and 'parent-last'", arg); } return NULL; } static const char *register_lua_scope(cmd_parms *cmd, void *_cfg, const char *scope, Loading Loading @@ -900,6 +924,7 @@ static const char *register_lua_scope(cmd_parms *cmd, #endif ,scope); } return NULL; } Loading Loading @@ -1008,6 +1033,10 @@ command_rec lua_commands[] = { AP_INIT_TAKE123("LuaScope", register_lua_scope, NULL, OR_ALL, "One of once, request, conn, server -- default is once"), AP_INIT_TAKE1("LuaInherit", register_lua_inherit, NULL, OR_ALL, "Controls how Lua scripts in parent contexts are merged with the current " " context: none|parent-last|parent-first (default: parent-first) "), AP_INIT_TAKE2("LuaQuickHandler", register_quick_hook, NULL, OR_ALL, "Provide a hook for the quick handler of request processing"), AP_INIT_RAW_ARGS("<LuaQuickHandler", register_quick_block, NULL, Loading @@ -1030,7 +1059,8 @@ static void *create_dir_config(apr_pool_t *p, char *dir) cfg->pool = p; cfg->hooks = apr_hash_make(p); cfg->dir = apr_pstrdup(p, dir); cfg->vm_scope = AP_LUA_SCOPE_ONCE; cfg->vm_scope = AP_LUA_SCOPE_UNSET; return cfg; } Loading Loading @@ -1067,6 +1097,58 @@ static int lua_post_config(apr_pool_t *pconf, apr_pool_t *plog, lua_ssl_is_https = APR_RETRIEVE_OPTIONAL_FN(ssl_is_https); return OK; } static void *overlay_hook_specs(apr_pool_t *p, const void *key, apr_ssize_t klen, const void *overlay_val, const void *base_val, const void *data) { const apr_array_header_t *overlay_info = (const apr_array_header_t*)overlay_val; const apr_array_header_t *base_info = (const apr_array_header_t*)base_val; apr_array_header_t *newspecs = apr_array_make(p, 2, sizeof(ap_lua_mapped_handler_spec *)); newspecs = apr_array_append(p, base_info, overlay_info); return newspecs; } static void *merge_dir_config(apr_pool_t *p, void *basev, void *overridesv) { ap_lua_dir_cfg *a, *base, *overrides; a = (ap_lua_dir_cfg *)apr_pcalloc(p, sizeof(ap_lua_dir_cfg)); base = (ap_lua_dir_cfg*)basev; overrides = (ap_lua_dir_cfg*)overridesv; a->pool = overrides->pool; a->dir = apr_pstrdup(p, overrides->dir); a->vm_scope = (overrides->vm_scope == AP_LUA_SCOPE_UNSET) ? base->vm_scope: overrides->vm_scope; a->inherit = (overrides->inherit== AP_LUA_INHERIT_UNSET) ? base->inherit : overrides->inherit; if (a->inherit == AP_LUA_INHERIT_UNSET || a->inherit == AP_LUA_INHERIT_PARENT_FIRST) { a->package_paths = apr_array_append(p, base->package_paths, overrides->package_paths); a->package_cpaths = apr_array_append(p, base->package_cpaths, overrides->package_cpaths); a->mapped_handlers = apr_array_append(p, base->mapped_handlers, overrides->mapped_handlers); a->hooks = apr_hash_merge(p, overrides->hooks, base->hooks, overlay_hook_specs, NULL); } else if (a->inherit == AP_LUA_INHERIT_PARENT_LAST) { a->package_paths = apr_array_append(p, overrides->package_paths, base->package_paths); a->package_cpaths = apr_array_append(p, overrides->package_cpaths, base->package_cpaths); a->mapped_handlers = apr_array_append(p, overrides->mapped_handlers, base->mapped_handlers); a->hooks = apr_hash_merge(p, base->hooks, overrides->hooks, overlay_hook_specs, NULL); } else { a->package_paths = overrides->package_paths; a->package_cpaths = overrides->package_cpaths; a->package_cpaths = overrides->package_cpaths; a->mapped_handlers= overrides->mapped_handlers; a->hooks= overrides->hooks; } return a; } static void lua_register_hooks(apr_pool_t *p) { Loading Loading @@ -1126,7 +1208,7 @@ static void lua_register_hooks(apr_pool_t *p) AP_DECLARE_MODULE(lua) = { STANDARD20_MODULE_STUFF, create_dir_config, /* create per-dir config structures */ NULL, /* merge per-dir config structures */ merge_dir_config, /* merge per-dir config structures */ create_server_config, /* create per-server config structures */ NULL, /* merge per-server config structures */ lua_commands, /* table of config file commands */ Loading Loading
CHANGES +4 −0 Original line number Diff line number Diff line -*- coding: utf-8 -*- Changes with Apache 2.3.16 *) mod_lua: Stop losing track of all but the most specific LuaHook* directives when multiple per-directory config sections are used. Adds LuaInherit directive to control how parent sections are merged. [Eric Covener] *) mod_cache: Make sure we merge headers correctly when we handle a non cacheable conditional response. PR52120. [Graham Leggett] Loading
docs/manual/mod/mod_lua.html.en +21 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ at any time.</div> <li><img alt="" src="../images/down.gif" /> <a href="#luahookmaptostorage">LuaHookMapToStorage</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#luahooktranslatename">LuaHookTranslateName</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#luahooktypechecker">LuaHookTypeChecker</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#luainherit">LuaInherit</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#luamaphandler">LuaMapHandler</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#luapackagecpath">LuaPackageCPath</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#luapackagepath">LuaPackagePath</a></li> Loading Loading @@ -630,6 +631,26 @@ end </table><p>...</p> </div> <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> <div class="directive-section"><h2><a name="LuaInherit" id="LuaInherit">LuaInherit</a> <a name="luainherit" id="luainherit">Directive</a></h2> <table class="directive"> <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Controls how parent configuration sections are merged into children</td></tr> <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LuaInherit none|parent-first|parent-last</code></td></tr> <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LuaInherit parent-first</code></td></tr> <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr> <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr> <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Experimental</td></tr> <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_lua</td></tr> <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>2.5.0 and later</td></tr> </table><p>By default, if LuaHook* directives are used in overlapping Directory or Location configuration sections, the scripts defined in the more specific section are run <em>after</em> those defined in the more generic section (LuaInherit parent-first). You can reverse this order, or make the parent context not apply at all.</p> <p> In previous 2.3.x releases, the default was effectively to ignore LuaHook* directives from parent configuration sections.</p> </div> <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> <div class="directive-section"><h2><a name="LuaMapHandler" id="LuaMapHandler">LuaMapHandler</a> <a name="luamaphandler" id="luamaphandler">Directive</a></h2> <table class="directive"> <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Map a path to a lua handler</td></tr> Loading
docs/manual/mod/mod_lua.xml +20 −0 Original line number Diff line number Diff line Loading @@ -725,6 +725,26 @@ hook function usually returns OK, DECLINED, or HTTP_FORBIDDEN.</p> <usage><p>Not Yet Implemented</p></usage> </directivesynopsis> <directivesynopsis> <name>LuaInherit</name> <description>Controls how parent configuration sections are merged into children</description> <syntax>LuaInherit none|parent-first|parent-last</syntax> <default>LuaInherit parent-first</default> <compatibility>2.5.0 and later</compatibility> <contextlist><context>server config</context><context>virtual host</context> <context>directory</context><context>.htaccess</context> </contextlist> <override>All</override> <usage><p>By default, if LuaHook* directives are used in overlapping Directory or Location configuration sections, the scripts defined in the more specific section are run <em>after</em> those defined in the more generic section (LuaInherit parent-first). You can reverse this order, or make the parent context not apply at all.</p> <p> In previous 2.3.x releases, the default was effectively to ignore LuaHook* directives from parent configuration sections.</p></usage> </directivesynopsis> <directivesynopsis> <name>LuaQuickHandler</name> <description>Provide a hook for the quick handler of request processing</description> Loading
modules/lua/lua_vmprep.h +1 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ #ifndef VMPREP_H #define VMPREP_H #define AP_LUA_SCOPE_UNSET 0 #define AP_LUA_SCOPE_ONCE 1 #define AP_LUA_SCOPE_REQUEST 2 #define AP_LUA_SCOPE_CONN 3 Loading
modules/lua/mod_lua.c +87 −5 Original line number Diff line number Diff line Loading @@ -115,8 +115,9 @@ static int lua_handler(request_rec *r) spec->file, "handle"); switch (dcfg->vm_scope) { switch (spec->scope) { case AP_LUA_SCOPE_ONCE: case AP_LUA_SCOPE_UNSET: apr_pool_create(&pool, r->pool); break; case AP_LUA_SCOPE_REQUEST: Loading Loading @@ -190,7 +191,7 @@ static int lua_request_rec_hook_harness(request_rec *r, const char *name, int ap spec = apr_pcalloc(r->pool, sizeof(ap_lua_vm_spec)); spec->file = hook_spec->file_name; spec->scope = hook_spec->scope; spec->scope = cfg->vm_scope; spec->bytecode = hook_spec->bytecode; spec->bytecode_len = hook_spec->bytecode_len; spec->pool = r->pool; Loading @@ -210,6 +211,7 @@ static int lua_request_rec_hook_harness(request_rec *r, const char *name, int ap switch (spec->scope) { case AP_LUA_SCOPE_ONCE: case AP_LUA_SCOPE_UNSET: apr_pool_create(&pool, r->pool); break; case AP_LUA_SCOPE_REQUEST: Loading Loading @@ -864,7 +866,29 @@ static const char *register_package_cdir(cmd_parms *cmd, return register_package_helper(cmd, arg, cfg->package_cpaths); } static const char *register_lua_inherit(cmd_parms *cmd, void *_cfg, const char *arg) { ap_lua_dir_cfg *cfg = (ap_lua_dir_cfg *) _cfg; if (strcasecmp("none", arg) == 0) { cfg->inherit = AP_LUA_INHERIT_NONE; } else if (strcasecmp("parent-first", arg) == 0) { cfg->inherit = AP_LUA_INHERIT_PARENT_FIRST; } else if (strcasecmp("parent-last", arg) == 0) { cfg->inherit = AP_LUA_INHERIT_PARENT_LAST; } else { return apr_psprintf(cmd->pool, "LuaInherit type of '%s' not recognized, valid " "options are 'none', 'parent-first', and 'parent-last'", arg); } return NULL; } static const char *register_lua_scope(cmd_parms *cmd, void *_cfg, const char *scope, Loading Loading @@ -900,6 +924,7 @@ static const char *register_lua_scope(cmd_parms *cmd, #endif ,scope); } return NULL; } Loading Loading @@ -1008,6 +1033,10 @@ command_rec lua_commands[] = { AP_INIT_TAKE123("LuaScope", register_lua_scope, NULL, OR_ALL, "One of once, request, conn, server -- default is once"), AP_INIT_TAKE1("LuaInherit", register_lua_inherit, NULL, OR_ALL, "Controls how Lua scripts in parent contexts are merged with the current " " context: none|parent-last|parent-first (default: parent-first) "), AP_INIT_TAKE2("LuaQuickHandler", register_quick_hook, NULL, OR_ALL, "Provide a hook for the quick handler of request processing"), AP_INIT_RAW_ARGS("<LuaQuickHandler", register_quick_block, NULL, Loading @@ -1030,7 +1059,8 @@ static void *create_dir_config(apr_pool_t *p, char *dir) cfg->pool = p; cfg->hooks = apr_hash_make(p); cfg->dir = apr_pstrdup(p, dir); cfg->vm_scope = AP_LUA_SCOPE_ONCE; cfg->vm_scope = AP_LUA_SCOPE_UNSET; return cfg; } Loading Loading @@ -1067,6 +1097,58 @@ static int lua_post_config(apr_pool_t *pconf, apr_pool_t *plog, lua_ssl_is_https = APR_RETRIEVE_OPTIONAL_FN(ssl_is_https); return OK; } static void *overlay_hook_specs(apr_pool_t *p, const void *key, apr_ssize_t klen, const void *overlay_val, const void *base_val, const void *data) { const apr_array_header_t *overlay_info = (const apr_array_header_t*)overlay_val; const apr_array_header_t *base_info = (const apr_array_header_t*)base_val; apr_array_header_t *newspecs = apr_array_make(p, 2, sizeof(ap_lua_mapped_handler_spec *)); newspecs = apr_array_append(p, base_info, overlay_info); return newspecs; } static void *merge_dir_config(apr_pool_t *p, void *basev, void *overridesv) { ap_lua_dir_cfg *a, *base, *overrides; a = (ap_lua_dir_cfg *)apr_pcalloc(p, sizeof(ap_lua_dir_cfg)); base = (ap_lua_dir_cfg*)basev; overrides = (ap_lua_dir_cfg*)overridesv; a->pool = overrides->pool; a->dir = apr_pstrdup(p, overrides->dir); a->vm_scope = (overrides->vm_scope == AP_LUA_SCOPE_UNSET) ? base->vm_scope: overrides->vm_scope; a->inherit = (overrides->inherit== AP_LUA_INHERIT_UNSET) ? base->inherit : overrides->inherit; if (a->inherit == AP_LUA_INHERIT_UNSET || a->inherit == AP_LUA_INHERIT_PARENT_FIRST) { a->package_paths = apr_array_append(p, base->package_paths, overrides->package_paths); a->package_cpaths = apr_array_append(p, base->package_cpaths, overrides->package_cpaths); a->mapped_handlers = apr_array_append(p, base->mapped_handlers, overrides->mapped_handlers); a->hooks = apr_hash_merge(p, overrides->hooks, base->hooks, overlay_hook_specs, NULL); } else if (a->inherit == AP_LUA_INHERIT_PARENT_LAST) { a->package_paths = apr_array_append(p, overrides->package_paths, base->package_paths); a->package_cpaths = apr_array_append(p, overrides->package_cpaths, base->package_cpaths); a->mapped_handlers = apr_array_append(p, overrides->mapped_handlers, base->mapped_handlers); a->hooks = apr_hash_merge(p, base->hooks, overrides->hooks, overlay_hook_specs, NULL); } else { a->package_paths = overrides->package_paths; a->package_cpaths = overrides->package_cpaths; a->package_cpaths = overrides->package_cpaths; a->mapped_handlers= overrides->mapped_handlers; a->hooks= overrides->hooks; } return a; } static void lua_register_hooks(apr_pool_t *p) { Loading Loading @@ -1126,7 +1208,7 @@ static void lua_register_hooks(apr_pool_t *p) AP_DECLARE_MODULE(lua) = { STANDARD20_MODULE_STUFF, create_dir_config, /* create per-dir config structures */ NULL, /* merge per-dir config structures */ merge_dir_config, /* merge per-dir config structures */ create_server_config, /* create per-server config structures */ NULL, /* merge per-server config structures */ lua_commands, /* table of config file commands */ Loading