You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Paul J. Reder" <re...@raleigh.ibm.com> on 2000/05/10 16:19:21 UTC
[Patch]: for util.c to make mod_rewrite work without caveats.
The following is a patch to fix Dirk's patch from March 14 so that
mod_rewrite will work without caveats. Basically Dirk was just
dropping patterns of the form ${x} if x didn't resolve to an
environment variable. That breaks mod_rewrite since mod_rewrite
uses the same syntax for some of its non-environment directives.
The patch below simply puts the behavior for unresolved values back
to what it was before Dirk's patch. If it is unresolved, it is just
left in the directive as is. Further processing will handle the value.
Dirk's optimization still holds if x is resolved. A small price is paid
if x is not resolved, but that shouldn't happen often.
--
Paul J. Reder
---------------------------------------------------------------------
Noise proves nothing. Often a hen who has merely laid an egg cackles
as if she laid an asteroid.
-- Mark Twain
(An apt quote in this political season.)
Index: util.c
===================================================================
RCS file: /home/cvspublic/apache-2.0/src/main/util.c,v
retrieving revision 1.41
diff -u -r1.41 util.c
--- util.c 2000/05/05 23:17:54 1.41
+++ util.c 2000/05/10 14:05:24
@@ -786,7 +786,12 @@
*e = '\0';
word = e + 1;
e = getenv(s+2);
- strcat(tmp,e ? e : "");
+ if (e) {
+ strcat(tmp,e);
+ } else {
+ strcat(tmp,s);
+ strcat(tmp,"}");
+ }
} else {
/* ignore invalid strings */
word = s+1;