-*- 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]
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)
{
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);