Bug 57211 - Config-time options
Summary: Config-time options
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_lua (show other bugs)
Version: 2.4.10
Hardware: PC Linux
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-14 04:09 UTC by Gregory A Lundberg
Modified: 2014-11-14 04:18 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gregory A Lundberg 2014-11-14 04:09:13 UTC
Code re-use would be enhanced if each mod_lua hander allowed config-time options.

At present LuaAuthzProvider accepts config-line options.

LuaQuickHandler, LuaHookTranslateName, LuaHookMapToStorage, LuaHookAccessChecker, LuaHookCheckUserID, LuaHookAuthChecker, LuaHookTypeChecker, LuaHookFixups, and LuaHookLog would benefit from similar features.

I'm on the fence as to whether LuaMapHandler would benefit, but can see the case to do so since it can avoid namespace pollution encoding options in the function name.

Several options allow 'early' and 'late' as an optional parameter. My thinking would be the add parsing of additional parameters following these, if present.

LuaAuthzProvider calls a function, assigning option strings to each parameter. When you want a variable number, say, from 1 to 3 optional words on the config line, you need to add a fourth parameter then test r-TO-l for nil to verify only 1, 2, or 3 parameters appeared.

My suggestion would be to store all command-line parameters in a single function parameter, as an array. Testing the number present then becomes simply checking the array length.
Comment 1 Gregory A Lundberg 2014-11-14 04:18:41 UTC
Thinking more on 'early' and 'late' it might also help to add 'normal' as an optional documentation of not-early and not-late, and then pass this parameter as the first element of the array I'm suggesting.  This would allow Lua code to handle all three timing conditions, reacting as appropriate to each.

I find myself doing TranslateEarly, Translate, and TranslateLate functions and simply injecting 'early', 'normal', 'late' into a call to a common local function handling all three cases.