From be6ef336b248743839cbaf7c2cf2b369121cddfb Mon Sep 17 00:00:00 2001
From: Eric Covener
Date: Tue, 7 Jan 2014 13:07:51 +0000
Subject: avoid a tight busy loop with memory allocations when the [N] flag
isn't making progress.
If backported, probably increase the hard-coded limit to 32k from 10k.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1556206 13f79535-47bb-0310-9956-ffa450edef68
---
docs/manual/rewrite/flags.xml | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
(limited to 'docs/manual/rewrite/flags.xml')
diff --git a/docs/manual/rewrite/flags.xml b/docs/manual/rewrite/flags.xml
index efdb746c16..675eb8fa8e 100644
--- a/docs/manual/rewrite/flags.xml
+++ b/docs/manual/rewrite/flags.xml
@@ -392,14 +392,22 @@ certain string or letter repeatedly in a request. The example shown here
will replace A with B everywhere in a request, and will continue doing
so until there are no more As to be replaced.
-
RewriteRule (.*)A(.*) $1B$2 [N]
-
You can think of this as a while
loop: While this
pattern still matches (i.e., while the URI still contains an
A
), perform this substitution (i.e., replace the
A
with a B
).
+In 2.5.0 and later, this module returns an error after 10,000 iterations to
+protect against unintended looping. An alternative maximum number of
+iterations can be specified by adding to the N flag.
+
+# Be willing to replace 1 character in each pass of the loop
+RewriteRule (.+)[><;]$ $1 [N=32000]
+# ... or, give up if after 10 loops
+RewriteRule (.+)[><;]$ $1 [N=10]
+
+