1
0
mirror of https://github.com/apache/httpd.git synced 2026-01-06 09:01:14 +03:00

add an internal sleep map function that expands to an empty string.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1239681 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Eric Covener
2012-02-02 15:51:09 +00:00
parent 38982673f2
commit 67ffac76d3
2 changed files with 20 additions and 0 deletions

View File

@@ -1,6 +1,10 @@
-*- 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]

View File

@@ -1083,6 +1083,21 @@ static char *rewrite_mapfunc_unescape(request_rec *r, char *key)
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)
{
@@ -4302,6 +4317,7 @@ static int pre_config(apr_pool_t *pconf,
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);