Daniel Gruno
49fcd96e73
Using the traditional way of declaring Lua functions does not seem to work with NetWare (and possibly Windows too?)
...
Thus, at least until we find a smarter way, we have to move the r:* functions into lua_request.c and connect them from there.
The only functional change is that the transferred functions are now called through the request object instead of the apache2 package.
The distinction between what merited it to be in either structure seems very vague, so for now, we'll keep the HTTP return codes in the apache2 table, and the request/server functions in the request object.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1433967 13f79535-47bb-0310-9956-ffa450edef68
2013-01-16 14:52:52 +00:00
Daniel Gruno
5a3e2e44dc
mod_lua: If a regex fails, return false plus an error message as second return value. Also fix some functions who weren't always returning a value.
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1422373 13f79535-47bb-0310-9956-ffa450edef68
2012-12-15 22:03:47 +00:00
Daniel Gruno
3b6cdb0f92
mod_lua: Add a lot of core httpd/apr functionality to mod_lua
...
(such as regex matching, expr evaluation, changing/fetching server configuration/info - see docs for a complete list).
This also includes a bunch of automatically scraped functions, which may or may not be super useful.
Comments appreciated as always, especially on the more hacky bits.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1420377 13f79535-47bb-0310-9956-ffa450edef68
2012-12-11 20:08:24 +00:00
Stefan Fritsch
5eddb6d978
more coding style (no logic change)
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1383028 13f79535-47bb-0310-9956-ffa450edef68
2012-09-10 18:37:23 +00:00
Stefan Fritsch
77e7551062
Fix warnings about unused variable and (false positive) "'mkey' may be used uninitialized in this function"
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1383022 13f79535-47bb-0310-9956-ffa450edef68
2012-09-10 18:25:17 +00:00
Stefan Fritsch
533878b7c7
Replace duplicate log msg numbers
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1383013 13f79535-47bb-0310-9956-ffa450edef68
2012-09-10 18:06:48 +00:00
Daniel Gruno
5ee40b970d
Trying to tie up some loose ends:
...
- Return immediately if the return val of ap_pass_brigade != APR_SUCCESS
- Return a bit earlier when dealing with input filters, so as to not build up a huge backlog.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1377685 13f79535-47bb-0310-9956-ffa450edef68
2012-08-27 13:57:43 +00:00
Daniel Gruno
b947d24d85
Fix some style issues, use a more persistent bucket for passing along data (and clean it up the right places), and remove in/out-put filters from the chain if need be.
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1377647 13f79535-47bb-0310-9956-ffa450edef68
2012-08-27 11:58:34 +00:00
Daniel Gruno
fd1fbe7908
Removing a misleading comment.
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1377601 13f79535-47bb-0310-9956-ffa450edef68
2012-08-27 08:46:29 +00:00
Daniel Gruno
58e7c2a350
Add new directives, LuaInputFilter/LuaOutputFilter for creating content filters using Lua.
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1377475 13f79535-47bb-0310-9956-ffa450edef68
2012-08-26 18:39:58 +00:00
Daniel Gruno
99afa83362
Add 'server' to scope_to_string's list of possible suspects, as to avoid an error when LogLevel is trace
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1377457 13f79535-47bb-0310-9956-ffa450edef68
2012-08-26 17:01:21 +00:00
Daniel Gruno
4141f17715
Add the missing state release to the LuaMapHandler handler as well, so we won't end in a potential deadlock when acquiring states for in the server scope.
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1374310 13f79535-47bb-0310-9956-ffa450edef68
2012-08-17 15:12:41 +00:00
Daniel Gruno
b7f2990d7b
Add a missing release of a Lua state (when server scope is used) when a hook returns DECLINED.
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1374295 13f79535-47bb-0310-9956-ffa450edef68
2012-08-17 14:45:33 +00:00
Daniel Gruno
71ca51c1a6
mod_lua: Allow scripts handled by the lua-script handler to set a return
...
code that will be sent to the client, such as 302, 500 etc. This will
allow scripts to be able to f.x. redirect a user to another page by
returning 302.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1374185 13f79535-47bb-0310-9956-ffa450edef68
2012-08-17 09:41:46 +00:00
Stefan Fritsch
7393da8892
There is only one global provider name space, therefore allow
...
LuaAuthzProvider only in global scope.
Remove unnecessary server config field.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1370466 13f79535-47bb-0310-9956-ffa450edef68
2012-08-07 19:38:09 +00:00
Daniel Gruno
d7b20ffb70
mod_lua: Decline to serve a request if the script doesn't exist, instead of throwing an internal server error.
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1370377 13f79535-47bb-0310-9956-ffa450edef68
2012-08-07 17:29:26 +00:00
Jeff Trawick
2e5559bb81
fix "lua_vmprep.c:29:6: warning: no previous prototype for ‘ap_lua_init_mutex’ [-Wmissing-prototypes]"
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1369800 13f79535-47bb-0310-9956-ffa450edef68
2012-08-06 12:05:47 +00:00
Daniel Gruno
25fa9a1809
Reverting r1369758
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1369763 13f79535-47bb-0310-9956-ffa450edef68
2012-08-06 09:52:50 +00:00
Daniel Gruno
864e336ee3
use the ap_mutex functions to create the mutex instead of the apr_mutex ones.
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1369758 13f79535-47bb-0310-9956-ffa450edef68
2012-08-06 09:26:10 +00:00
Daniel Gruno
b598e862d3
Add a server scope for Lua states (in LuaScope), which creates a pool of states with manageable minimum and maximum size.
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1369656 13f79535-47bb-0310-9956-ffa450edef68
2012-08-05 19:57:44 +00:00
Stefan Fritsch
87bcd2414a
Revert r1367504:
...
mod_lua: The current way of getting the authz provider name doesn't
seem to work. This approach should fix that.
This is not necessary and breaks with "Require not ..."
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1369617 13f79535-47bb-0310-9956-ffa450edef68
2012-08-05 16:51:09 +00:00
Jeff Trawick
ea66bb37ca
mod_lua.c:189:13: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1368109 13f79535-47bb-0310-9956-ffa450edef68
2012-08-01 16:41:04 +00:00
Daniel Gruno
238af542a3
mod_lua:
...
Clean up style
use apr_pstrcat instead of apr_psprintf
fix a bug that was causing bad string interpolations.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1367875 13f79535-47bb-0310-9956-ffa450edef68
2012-08-01 07:28:22 +00:00
Daniel Gruno
5e36abf35a
mod_lua: Add the (missing) LuaMapHandler directive to the fold.
...
This should work as the existing documentation describes.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1367725 13f79535-47bb-0310-9956-ffa450edef68
2012-07-31 19:43:29 +00:00
Daniel Gruno
ce1213a92d
mod_lua: The current way of getting the authz provider name doesn't seem to work. This approach should fix that.
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1367504 13f79535-47bb-0310-9956-ffa450edef68
2012-07-31 11:47:04 +00:00
Daniel Gruno
664f924857
mod_lua: Remember to set cfg->codecache to AP_LUA_CACHE_UNSET when creating a config
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1367048 13f79535-47bb-0310-9956-ffa450edef68
2012-07-30 09:36:44 +00:00
Daniel Gruno
c67acaa6fc
mod_lua: Pass on the request_rec to ap_lua_get_lua_state, so we can use it for allocating memory for the cache info lookup.
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1367040 13f79535-47bb-0310-9956-ffa450edef68
2012-07-30 09:06:41 +00:00
Daniel Gruno
f9b07d1b34
Add LuaCodeCache directive for controlling in-memory caching.
...
This might need some tweaking on the hash key generation for the mtime lookups, ideas are welcome.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1366890 13f79535-47bb-0310-9956-ffa450edef68
2012-07-29 19:07:38 +00:00
Stefan Fritsch
8c960a8c15
Various code clean up
...
Submitted by: Christophe JAILLET <christophe jaillet wanadoo fr>
PR: 52893
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1361801 13f79535-47bb-0310-9956-ffa450edef68
2012-07-15 21:14:00 +00:00
Stefan Fritsch
99d37b2e33
Add new directive LuaAuthzProvider to allow implementing an
...
authorization provider in lua
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1351020 13f79535-47bb-0310-9956-ffa450edef68
2012-06-16 22:51:19 +00:00
Stefan Fritsch
d7ed5d0ed6
factor common code into utility function
...
also improve logging a bit and adjust some log levels
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1351018 13f79535-47bb-0310-9956-ffa450edef68
2012-06-16 22:46:30 +00:00
Stefan Fritsch
cbb93c651b
change various strings from char * to const char *
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1351017 13f79535-47bb-0310-9956-ffa450edef68
2012-06-16 22:45:33 +00:00
Stefan Fritsch
76f782e188
Various code cleanup to avoid compiler, cppcheck, or clang warnings:
...
modules/debugging/mod_firehose.c: Make some internal functions static
(to do: logs_cleanup() is unused)
modules/filters/mod_charset_lite.c: Remove dead assignments
modules/filters/mod_include.c: likewise
modules/metadata/mod_usertrack.c: likewise
modules/proxy/mod_proxy_ftp.c: likewise
modules/ssl/ssl_engine_pphrase.c: likewise
modules/proxy/mod_proxy_balancer.c: likewise;
Remove NULL check that can never happen
modules/proxy/proxy_util.c: Axe NULL-check that can never happen and if it
would, it would just mask another bug
os/unix/unixd.c: likewise
modules/http/http_filters.c: Remove sub-condition that is always true
modules/lua/mod_lua.c: Add default cases to switch statements
modules/generators/mod_autoindex.c: Unsigned value can never be < 0
server/util_expr_eval.c: Fix compiler warnings with VC and on OS2
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1220493 13f79535-47bb-0310-9956-ffa450edef68
2011-12-18 17:52:59 +00:00
Stefan Fritsch
b9dacea0ea
remove some dead code
...
found by clang statical analyzer
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1220462 13f79535-47bb-0310-9956-ffa450edef68
2011-12-18 17:25:40 +00:00
Stefan Fritsch
92e366007c
Add lots of unique tags to error log messages
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1209766 13f79535-47bb-0310-9956-ffa450edef68
2011-12-02 23:02:04 +00:00
Eric Covener
b53e38b314
add per-dir config merging to mod_lua so LuaHook* in multiple per-dir sections
...
behaves as expected instead of discarding previous sections.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1201443 13f79535-47bb-0310-9956-ffa450edef68
2011-11-13 15:48:06 +00:00
Rainer Jung
24b66f8823
Use the right lua scope when used as a hook.
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1201042 13f79535-47bb-0310-9956-ffa450edef68
2011-11-11 20:22:08 +00:00
Eric Covener
727cca9fdb
don't let thread-scope be selected in a server w/o threads
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1200977 13f79535-47bb-0310-9956-ffa450edef68
2011-11-11 17:30:18 +00:00
Eric Covener
45b5bfb549
C99 and unused variable warnings
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1200975 13f79535-47bb-0310-9956-ffa450edef68
2011-11-11 17:27:06 +00:00
Brian McCallister
bed1f11a32
use a sub-pool for scope_once
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1200667 13f79535-47bb-0310-9956-ffa450edef68
2011-11-11 00:49:05 +00:00
Brian McCallister
bc7ecfdcf9
replace server scope with thread scope
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1200656 13f79535-47bb-0310-9956-ffa450edef68
2011-11-11 00:16:56 +00:00
Brian McCallister
49ac1fbeb2
remove lingering reslist references before killing server scope
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1200646 13f79535-47bb-0310-9956-ffa450edef68
2011-11-10 23:57:57 +00:00
Brian McCallister
1278d68ae7
remove ability to set min and max pool sizes for server scope in prep for removing server scope
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1200639 13f79535-47bb-0310-9956-ffa450edef68
2011-11-10 23:54:00 +00:00
Brian McCallister
db8040ed4f
remove some debug logging which snuck in
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1200614 13f79535-47bb-0310-9956-ffa450edef68
2011-11-10 23:13:08 +00:00
Joe Orton
48a5e0390d
* modules/lua/mod_lua.c (ap_lua_ssl_is_https): New function.
...
(lua_post_config): Pick up ssl_is_https optional function.
* modules/lua/lua_request.c (req_ssl_is_https_field): New function.
(ap_lua_load_request): Map is_https field to above.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1200580 13f79535-47bb-0310-9956-ffa450edef68
2011-11-10 21:45:27 +00:00
Brian McCallister
5eb6753e25
remove last traces of the code cache
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1200513 13f79535-47bb-0310-9956-ffa450edef68
2011-11-10 20:02:07 +00:00
Brian McCallister
1cedf45414
fix issue with incorrect munging of the lua package path -- LuaPackagePath directives were not working
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1200475 13f79535-47bb-0310-9956-ffa450edef68
2011-11-10 18:48:50 +00:00
Eric Covener
2fb4d8c18f
ap_check_cmd_context checks don't work on the block forms
...
of the lua directives.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1200204 13f79535-47bb-0310-9956-ffa450edef68
2011-11-10 07:30:55 +00:00
Eric Covener
2af550c8c9
mod_lua: Expose SSL variables via r:ssl_var_lookup()
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1199056 13f79535-47bb-0310-9956-ffa450edef68
2011-11-08 01:53:15 +00:00
Eric Covener
d63996c35d
allow some lua hooks to be run in "early" or "late" mode
...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1199031 13f79535-47bb-0310-9956-ffa450edef68
2011-11-08 00:36:03 +00:00