httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cove...@apache.org
Subject svn commit: r1239681 - in /httpd/httpd/trunk: CHANGES modules/mappers/mod_rewrite.c
Date Thu, 02 Feb 2012 15:51:10 GMT
Author: covener
Date: Thu Feb  2 15:51:09 2012
New Revision: 1239681

URL: http://svn.apache.org/viewvc?rev=1239681&view=rev
Log:
add an internal sleep map function that expands to an empty string.


Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/modules/mappers/mod_rewrite.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1239681&r1=1239680&r2=1239681&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Thu Feb  2 15:51:09 2012
@@ -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]

Modified: httpd/httpd/trunk/modules/mappers/mod_rewrite.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_rewrite.c?rev=1239681&r1=1239680&r2=1239681&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/mappers/mod_rewrite.c (original)
+++ httpd/httpd/trunk/modules/mappers/mod_rewrite.c Thu Feb  2 15:51:09 2012
@@ -1083,6 +1083,21 @@ static char *rewrite_mapfunc_unescape(re
 
     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);



Mime
View raw message