Commit Graph

102 Commits

Author SHA1 Message Date
e149a8d8d0 Fix some style issue.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1772490 13f79535-47bb-0310-9956-ffa450edef68
2016-12-03 21:59:55 +00:00
cd677cee0c The default value of 'inherit' should be AP_LUA_INHERIT_UNSET.
With this value, the behavior is the same as 'parent-first' in the 'LuaInherit' directive

If not explicitelly initialized, its value is 0 because of the 'apr_calloc 'in 'create_dir_config'. 0 means 'AP_LUA_INHERIT_NONE'

PR 60419

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1772489 13f79535-47bb-0310-9956-ffa450edef68
2016-12-03 21:37:52 +00:00
d79b514c4b Fix spelling in comments and text files.
No functional change.
PR 59990


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1756038 13f79535-47bb-0310-9956-ffa450edef68
2016-08-11 19:50:02 +00:00
bf5205907b * modules/lua/mod_lua.c (lua_post_config): Use anonymous shm segment
in preference to named segment.  Ensure startup is possible after an
  unclean shutdown.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1738229 13f79535-47bb-0310-9956-ffa450edef68
2016-04-08 11:02:14 +00:00
af14d158a3 Added many log numbers to log statements that
had none.

Those were not detected by the coccinelle script.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1725485 13f79535-47bb-0310-9956-ffa450edef68
2016-01-19 12:02:41 +00:00
44ce30494e Added many log numbers to log statements that
had none.

Handled all files in modules/.

I used the coccinelle script provided by Stefan.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1725392 13f79535-47bb-0310-9956-ffa450edef68
2016-01-19 00:03:18 +00:00
eca303e318 * mod_lua: fix compilation with lua-5.3
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1668827 13f79535-47bb-0310-9956-ffa450edef68
2015-03-24 09:13:12 +00:00
38535f55b1 *) SECURITY: CVE-2014-8109 (cve.mitre.org)
mod_lua: Fix handling of the Require line when a LuaAuthzProvider is
     used in multiple Require directives with different arguments.
     PR57204 [Edward Lu <Chaosed0 gmail.com>]

Submitted By: Edward Lu
Committed By: covener



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1642499 13f79535-47bb-0310-9956-ffa450edef68
2014-11-30 01:41:26 +00:00
56d0c25725 Add missing APLOGNO.
Refactor some lines to keep APLOGNO on the same line as ap_log_error, when applicable.
Split lines longer than 80.
Improve alignment.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1612068 13f79535-47bb-0310-9956-ffa450edef68
2014-07-20 09:32:58 +00:00
ccb1c5181a mod_lua: Remove dead code left over from the old code cache.
The code that used this was commented out in r721594, then removed entirely in
r728497, and finally a commit was made intending to remove the last traces of
the code cache in r1200513, but this initialization lived on anyway.

* modules/lua/mod_lua.c
  (create_server_config): Remove unused empty hash and rwlock for hash.

* modules/lua/mod_lua.h
  (ap_lua_server_cfg): Remove unneeded hash and rwlock entries.

Found by: Bert Huijben <rhuijben{_at_}collab.net>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1606836 13f79535-47bb-0310-9956-ffa450edef68
2014-06-30 16:54:27 +00:00
303f962ea6 Follow up to r1604336: Comment out hooks whose only references are
now commented out, fixing a "-Wunused-function" warning


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1604631 13f79535-47bb-0310-9956-ffa450edef68
2014-06-22 18:14:31 +00:00
0ac4c9dc26 Revert early|late argument for LuaHookCheckUserID as it does not work right now.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1604336 13f79535-47bb-0310-9956-ffa450edef68
2014-06-21 10:36:56 +00:00
8ad00113ae mod_lua: Reformat and escape script error output.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1582247 13f79535-47bb-0310-9956-ffa450edef68
2014-03-27 10:44:43 +00:00
31ad0e2d6b mod_lua: be a bit more verbose in error logging.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1578825 13f79535-47bb-0310-9956-ffa450edef68
2014-03-18 11:26:04 +00:00
82e4ee75b0 mod_lua: Add a fixups hook that checks if the original request is intended for LuaMapHandler. This fixes a bug where FallbackResource invalidates the LuaMapHandler directive in certain cases by changing the URI before the map handler code executes.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1576981 13f79535-47bb-0310-9956-ffa450edef68
2014-03-12 22:56:44 +00:00
3f96d9992f 'ap_getword_conf' can not return NULL
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1551010 13f79535-47bb-0310-9956-ffa450edef68
2013-12-15 10:26:12 +00:00
a8ad7b0e63 r1526906 followup:
error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1527063 13f79535-47bb-0310-9956-ffa450edef68
2013-09-27 20:30:47 +00:00
5a2ba0a377 mod_lua: Use a (new) global pool/mutex setup for IVM rather than a per-process pool.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1526906 13f79535-47bb-0310-9956-ffa450edef68
2013-09-27 13:56:53 +00:00
227ffd6486 mod_lua: If the first yield() of a LuaOutputFilter returns a string, it should
be prefixed to the response as documented.

Also, don't put empty heap buckets in the brigade if a yield() is called with 
no string.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1519492 13f79535-47bb-0310-9956-ffa450edef68
2013-09-02 18:38:07 +00:00
8582560883 mod_lua: Remove ETAG, Content-Length, and Content-MD5 when a LuaOutputFilter
is configured without mod_filter. [Eric Covener]



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1519483 13f79535-47bb-0310-9956-ffa450edef68
2013-09-02 17:45:40 +00:00
bc12f5ca71 register LuaOutputFilters with AP_FILTER_PROTO_CHANGE|AP_FILTER_PROTO_CHANGE_LENGTH
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1519476 13f79535-47bb-0310-9956-ffa450edef68
2013-09-02 17:06:16 +00:00
d7aa057282 Return a 500 error instead of DECLINED when LuaHook* script does not
return a numeric value.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1519398 13f79535-47bb-0310-9956-ffa450edef68
2013-09-02 11:43:53 +00:00
20996af3ee trace4 logging of return codes from LuaHook* functions.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1519329 13f79535-47bb-0310-9956-ffa450edef68
2013-09-02 01:21:39 +00:00
1ad63fbb73 Adding a simple logging hook for mod_lua, which allows users to create their own logs or bypass the generic logging on a per-request basis.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1519277 13f79535-47bb-0310-9956-ffa450edef68
2013-09-01 15:10:32 +00:00
a43dd91645 tolerate LuaMapHandler scripts that don't return anything
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1490098 13f79535-47bb-0310-9956-ffa450edef68
2013-06-06 01:04:17 +00:00
586e050124 Remove unneeded exports from mod_lua - part 2.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1488114 13f79535-47bb-0310-9956-ffa450edef68
2013-05-31 07:03:15 +00:00
98ebff29d7 Use a mutex to control read/write for IVM values, so we can reuse the existing structures without running into race conditions.
This should get rid of the need to have MaxConnectionsPerChild set to > 0.

If a new value is set and is a string, we either use the existing varbuf or grow it accordingly.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1470156 13f79535-47bb-0310-9956-ffa450edef68
2013-04-20 12:26:05 +00:00
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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