-*- coding: utf-8 -*-
Changes with Apache 2.5.0
- *) mod_rewrite: Add an internal RewriteMap function named "sleep"
- that always returns an empty value and sleeps for the specified
- interval. [Eric Covener]
-
- *) mod_rewrite: Treat a RewriteRule substitution that expands to
- "-" to behave as if a literal "-" was used in the RewriteRule
- (no substitution). [Eric Covener]
-
*) mod_authnz_ldap: Don't try a potentially expensive nested groups
search before exhausting all AuthLDAPGroupAttribute checks on the
current group. PR52464 [Eric Covener]
utility. (<a href="../rewrite/rewritemap.html#dbm">Details ...</a>)</dd>
<dt>int</dt>
- <dd>One of the five available internal functions provided by
- <code>RewriteMap</code>: toupper, tolower, escape, unescape, or sleep.
- (<a href="../rewrite/rewritemap.html#int">Details ...</a>)</dd>
+ <dd>One of the four available internal functions provided by
+ <code>RewriteMap</code>: toupper, tolower, escape or
+ unescape. (<a href="../rewrite/rewritemap.html#int">Details ...</a>)</dd>
<dt>prg</dt>
<dd>Calls an external program or script to process the
<dd>A dash indicates that no substitution should be performed
(the existing path is passed through untouched). This is used
when a flag (see below) needs to be applied without changing
- the path. In Apache HTTP Server 2.5.0 and later, a substitution
- that ultimately expands to this single character is also treated as
- "no substitution".</dd>
+ the path.</dd>
</dl>
<li><strong>unescape</strong>:<br/>
Translates hex-encodings in the key back to
special characters.</li>
- <li><strong>sleep</strong>:<br/>
- Causes the request to sleep for the amount of time specified in
- the key, in milliseconds. Keys are accepted in the form of
- "2000", "2000ms", or "2s". This map always returns an empty value.
- <p> Available since Apache HTTP Server 2.5.0</p> </li>
</ul>
<p>
RewriteMap lc int:tolower<br />
RewriteRule (.*?[A-Z]+.*) ${lc:$1} [R]
</example>
-
- <example><title>Delay a request by one half of a second</title>
- RewriteMap sleep int:sleep<br />
- RewriteRule ^/foo/bar.html -${sleep:"500ms"}
- </example>
-
<note>
<p>Please note that the example offered here is for
return key;
}
-static char *rewrite_mapfunc_sleep(request_rec *r, char *key)
-{
- apr_interval_time_t timeout;
- apr_status_t rv;
-
- if ((rv = ap_timeout_parameter_parse(key, &timeout, "ms")) != APR_SUCCESS) {
- ap_log_rerror(APLOG_MARK, APLOG_ERROR, rv, r, APLOGNO(02295)
- "Bad parameter to internal sleep map: '%s'", key);
- }
- else {
- apr_sleep(timeout);
- }
-
- return "";
-}
static char *select_random_value_part(request_rec *r, char *value)
{
char *newuri = NULL;
request_rec *r = ctx->r;
int is_proxyreq = 0;
- int force_no_sub = 0;
ctx->uri = r->filename;
newuri = do_expand(p->output, ctx, p);
rewritelog((r, 2, ctx->perdir, "rewrite '%s' -> '%s'", ctx->uri,
newuri));
- /* Allow a substitution to resolve to "-" and act like a literal "-" */
- if (newuri && *newuri == '-' && !newuri[1]) {
- newuri = NULL;
- force_no_sub = 1;
- }
}
/* expand [E=var:val] and [CO=<cookie>] */
do_expand_cookie(p->cookie, ctx);
/* non-substitution rules ('RewriteRule <pat> -') end here. */
- if (p->flags & RULEFLAG_NOSUB || force_no_sub) {
+ if (p->flags & RULEFLAG_NOSUB) {
force_type_handler(p, ctx);
if (p->flags & RULEFLAG_STATUS) {
map_pfn_register("toupper", rewrite_mapfunc_toupper);
map_pfn_register("escape", rewrite_mapfunc_escape);
map_pfn_register("unescape", rewrite_mapfunc_unescape);
- map_pfn_register("sleep", rewrite_mapfunc_sleep);
}
dbd_acquire = APR_RETRIEVE_OPTIONAL_FN(ap_dbd_acquire);
dbd_prepare = APR_RETRIEVE_OPTIONAL_FN(ap_dbd_prepare);