Commit Graph

51 Commits

Author SHA1 Message Date
6c8ea86f41 ap_expr: Add req_novary function that allows HTTP header lookups
without adding the name to the Vary header 


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1403483 13f79535-47bb-0310-9956-ffa450edef68
2012-10-29 20:34:18 +00:00
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
cb21a0dbcc Further clarify the naming of the entity that directly connects to us by
calling that entity a client instead of a peer.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1214015 13f79535-47bb-0310-9956-ffa450edef68
2011-12-14 01:10:52 +00:00
ad489c105b Further clarify the naming of the entity that originates the request by
calling that entity a useragent instead of a client.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1214005 13f79535-47bb-0310-9956-ffa450edef68
2011-12-14 00:33:46 +00:00
e6d1031885 Explicitly cast function pointer, to remove 'const'.
Hopefully this makes the NetWare compiler happy.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1213567 13f79535-47bb-0310-9956-ffa450edef68
2011-12-13 05:53:50 +00:00
e0a5a7882e Fix names of unary operators like '-s' being compared case insensitively.
Improve error message if op or function is not found. Document '-s' operator. 


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1212883 13f79535-47bb-0310-9956-ffa450edef68
2011-12-10 21:26:00 +00:00
0f05cbe719 Fix a few compiler warning reported by Steffen:
- some signed/unsigned mismatches
- const for a function does not make sense


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1210378 13f79535-47bb-0310-9956-ffa450edef68
2011-12-05 09:38:44 +00:00
26d5fb7164 Add some more log message tags
Remove some log message tags from ap_log_* calls that log lots of
different error messages, in particular the config parsing errors.
Not sure how we should handle those.

ssl_util.c: Downgrade some dynamic locking messages from level DEBUG
to TRACE1-3



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1210252 13f79535-47bb-0310-9956-ffa450edef68
2011-12-04 22:09:24 +00:00
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
394e5594d6 Introduce a per connection "peer_ip" and a per request "client_ip" to
distinguish between the raw IP address of the connection and the effective
IP address of the request.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1206291 13f79535-47bb-0310-9956-ffa450edef68
2011-11-25 19:42:04 +00:00
f94cf9a7f0 Hello. Let's compile again.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1204998 13f79535-47bb-0310-9956-ffa450edef68
2011-11-22 14:02:25 +00:00
7df4fb3537 Add the ability to access the connection level remote IP address from the
expression parser.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1204990 13f79535-47bb-0310-9956-ffa450edef68
2011-11-22 13:40:58 +00:00
4ee7eea4cf Introduce a per request version of the remote IP address, which can be
optionally modified by a module when the effective IP of the client
is not the same as the real IP of the client (such as a load balancer).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1204968 13f79535-47bb-0310-9956-ffa450edef68
2011-11-22 13:10:39 +00:00
294efcbd32 clarify comment
remove broken recursion counting bits


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1204090 13f79535-47bb-0310-9956-ffa450edef68
2011-11-19 22:06:16 +00:00
92663b1e32 Limit recursion in ap_expr evaluation to avoid unbounded stack usage
* evaluate chains of ||, &&, and string concatenation non-recursively
* limit other types of recursion to 20 levels
* avoid some string copies if concatenating more than 2 strings


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1204087 13f79535-47bb-0310-9956-ffa450edef68
2011-11-19 21:58:48 +00:00
02302c9049 regex related cleanups:
- use AP_MAX_REG_MATCH where appropriate
- in mod_proxy_ftp, compile the "ls -s1" regex only once instead of once per request
- add some coments


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1185898 13f79535-47bb-0310-9956-ffa450edef68
2011-10-18 22:02:26 +00:00
1951a037bf More cleanup: Expand tabs and some more indentation fixes
No functional change


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1174929 13f79535-47bb-0310-9956-ffa450edef68
2011-09-23 18:08:42 +00:00
427c85bd23 Cleanup effort in prep for GA push:
Trim trailing whitespace... no func change



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1174751 13f79535-47bb-0310-9956-ffa450edef68
2011-09-23 13:39:32 +00:00
8281a318cf Do proper length checks in the expression scanner. This allows to remove the
8K length limit for expressions. Strings/Regexs in an expression are still
limited to 8K, though.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1157362 13f79535-47bb-0310-9956-ffa450edef68
2011-08-13 09:59:43 +00:00
f0cf7722ba Use ap_unescape_url_keep2f() in ap_expr unescape func. ap_unescape_url()
forbidding encoded slashes is not useful here.
Log failures.
Improve docs.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1151373 13f79535-47bb-0310-9956-ffa450edef68
2011-07-27 08:03:41 +00:00
481fac5ce2 Make the SERVER_NAME variable include [ ] for literal IPv6 addresses, as
mandated by RFC 3875

PR: 26005


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1147614 13f79535-47bb-0310-9956-ffa450edef68
2011-07-17 13:56:28 +00:00
46d4791a5d Add string valued expressions to ap_expr, do some API cleanup
- add possibility to have expressions that evaluate to a string and not to
  a boolean value
- modify ap_expr_parse_cmd() interface to support this and make it more
  convenient to use in general
- rename AP_EXPR_FLAGS_* to AP_EXPR_FLAG_* for consistency


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1142164 13f79535-47bb-0310-9956-ffa450edef68
2011-07-02 07:45:00 +00:00
0ddae368ab Add REQUEST_STATUS variable to ap_expr
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1142163 13f79535-47bb-0310-9956-ffa450edef68
2011-07-02 07:32:26 +00:00
255f723fef We already have ap_str_tolower(), so also add ap_str_toupper() function and use
it where possible.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1138617 13f79535-47bb-0310-9956-ffa450edef68
2011-06-22 20:24:27 +00:00
c9fd2623da Introduce ap_(get|set)_core_module_config() functions/macros and use them
everywhere.

We know that the core module has module_index 0. Therefore we can save
some pointer operations in ap_get_module_config(cv, &core_module) and
ap_set_module_config(cv, &core_module, val). As these are called rather often,
this may actually have some (small) measurable effect.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1132781 13f79535-47bb-0310-9956-ffa450edef68
2011-06-06 21:26:56 +00:00
feca55db60 - Introduce concept of context prefix (which is an URL prefix)
and context document root (which is the file system directory that
  this URL prefix is mapped to). This generalization of the document
  root makes it easier for scripts to create self-referential URLs and
  to find their files.
- Expose CONTEXT_DOCUMENT_ROOT and CONTEXT_PREFIX as envvars, in mod_rewrite,
  and in ap_expr.
- Make mod_alias and mod_userdir set the context information.
- Allow to override the document root on a per-request basis. This allows
  mass vhosting modules to set DOCUMENT_ROOT correctly.
- Make mod_vhost_alias set the per-request document root

PR: 26052, 46198, 49705

Remaining tasks:
- Use the context document root & prefix in mod_rewrite to make RewriteBase
  unneccessary in many cases. Do this without breaking compatibility.
- Write docs.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1132494 13f79535-47bb-0310-9956-ffa450edef68
2011-06-05 21:33:12 +00:00
89ec663ca3 Fix wrong condition that may lead to NULL being set as 'Vary' header
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1132467 13f79535-47bb-0310-9956-ffa450edef68
2011-06-05 18:06:42 +00:00
a8c135f27e Add some features to ap_expr for use by mod_include:
* a restricted mode that does not allow to bypass request access restrictions
 * new variables DOCUMENT_URI (alias for REQUEST_URI), LAST_MODIFIED
 * -A as an alias for -U
 * an additional data entry in ap_expr_eval_ctx_t for use by the consumer
 * an extensible ap_expr_exec_ctx() API that allows to use that data entry


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1128564 13f79535-47bb-0310-9956-ffa450edef68
2011-05-28 07:01:47 +00:00
a88e191cd5 Also add the -U and -F operators for doing subrequest lookups to ap_expr.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1103126 13f79535-47bb-0310-9956-ffa450edef68
2011-05-14 15:12:33 +00:00
17651e0c9a Add various file existance test operators to ap_expr
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1103097 13f79535-47bb-0310-9956-ffa450edef68
2011-05-14 13:22:11 +00:00
e8715105b8 * server/util_expr_eval.c (req_table_func): Try r->err_headers_out for
response headers if given header is not found in r->headers_out
  (e.g. as with non-standard headers from CGI scripts).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1090234 13f79535-47bb-0310-9956-ffa450edef68
2011-04-08 13:13:36 +00:00
d489f13739 Add mod_rewrite's SCRIPT_USER/SCRIPT_GROUP vars to ap_expr
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1053882 13f79535-47bb-0310-9956-ffa450edef68
2010-12-30 13:00:36 +00:00
0ec9bd6fdc Add -T operator to allow easy evaluation of on/off, 1/0, ... variables
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1053865 13f79535-47bb-0310-9956-ffa450edef68
2010-12-30 11:59:02 +00:00
adca7b491e indentation + coding style fixes
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1044679 13f79535-47bb-0310-9956-ffa450edef68
2010-12-11 17:16:54 +00:00
b93e49391b Rename ap_expr's typedef names:
ap_expr            ->  ap_expr_t
ap_expr_parse_ctx  ->  ap_expr_parse_ctx_t
ap_expr_eval_ctx   ->  ap_expr_eval_ctx_t
ap_expr_lookup_fn  ->  ap_expr_lookup_fn_t
ap_expr_node_op    ->  ap_expr_node_op_e


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1042146 13f79535-47bb-0310-9956-ffa450edef68
2010-12-04 11:22:30 +00:00
e27a3c21e3 - add -ipmatch, -str(c)match, -fnmatch, -R operators to ap_expr
- allow lookup function to pre-parse string constant arguments 
  (used for subnet masks so far)
- various bug fixes for binary operators
- do strdup() for error messages created on the stack to avoid corruption


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1039900 13f79535-47bb-0310-9956-ffa450edef68
2010-11-28 16:35:14 +00:00
c409988d42 Fix another Windows build issue: Add a wrapper around ap_run_expr_lookup with
the correct calling convention.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1039528 13f79535-47bb-0310-9956-ffa450edef68
2010-11-26 19:32:13 +00:00
a4454cb0e2 Fix for picky compilers.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1037605 13f79535-47bb-0310-9956-ffa450edef68
2010-11-22 05:02:56 +00:00
b6649687a3 More ap_expr updates:
- minor bump for ap_expr_exec_re() introduced in r1037504
- actually commit the changes to allow using backreferences in SetEnvIfExpr
- automatically add the correct entries to the Vary-header if the result of
  an expression evaluation depends on a request header
  (can be turned off by setting the AP_EXPR_FLAGS_DONT_VARY flag)
- set AP_EXPR_FLAGS_DONT_VARY in mod_log_config's conditional logging
- fix various off-by-one errors in req_table_func


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1037540 13f79535-47bb-0310-9956-ffa450edef68
2010-11-21 19:51:41 +00:00
6ef1911acc ap_expr related fixes/enhancements:
- implement regex backreferences and make them available for setting 
  envvars in SetEnvIfExpr
- implement nested function calls in %-syntax: %{func1:%{func2:arg}} 
- actually implement evaluation of concatenation operator (oops...)
- Fix <If ... > treating an internal error as success


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1037504 13f79535-47bb-0310-9956-ffa450edef68
2010-11-21 17:22:26 +00:00
b4db6ddb3e Don't compile expr_dump_tree() by default
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1037325 13f79535-47bb-0310-9956-ffa450edef68
2010-11-20 20:42:57 +00:00
53d0129701 Check input lenght to avoid potential overflows
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1037321 13f79535-47bb-0310-9956-ffa450edef68
2010-11-20 20:26:37 +00:00
c40fa87ce7 Log errors/infos during expression evaluation and associate the message
with the module that is calling ap_expr_exec()


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1037140 13f79535-47bb-0310-9956-ffa450edef68
2010-11-20 08:59:50 +00:00
86508e66ab support error log id as variables
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1033167 13f79535-47bb-0310-9956-ffa450edef68
2010-11-09 19:24:45 +00:00
b6aec76bc1 Support %{HANDLER} in ap_expr (required for mod_filter)
Update mod_filter docs


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1032413 13f79535-47bb-0310-9956-ffa450edef68
2010-11-07 22:53:59 +00:00
6056703807 Implement "reqenv", "note", "-z", "-n" in ap_expr.
Make "env" ssl_expr compatible


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1032408 13f79535-47bb-0310-9956-ffa450edef68
2010-11-07 22:06:33 +00:00
29d566dd9b Port "file" function from ssl_expr
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1032393 13f79535-47bb-0310-9956-ffa450edef68
2010-11-07 21:09:19 +00:00
94c5270ab5 More fixes for picky compilers
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1032268 13f79535-47bb-0310-9956-ffa450edef68
2010-11-07 13:00:00 +00:00
bed44770b5 Implement "HTTPS" and "IPV6" vars in ap_expr
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1032170 13f79535-47bb-0310-9956-ffa450edef68
2010-11-06 22:21:46 +00:00
50efd54644 Netware build fixes
Submitted by: NormW <normw gknw net>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1032163 13f79535-47bb-0310-9956-ffa450edef68
2010-11-06 21:47:39 +00:00