httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pennywize Support <supp...@pennywize.com>
Subject Re: [PATCH] apache_1.3.28/src/modules/standard/mod_rewrite.c
Date Mon, 28 Jul 2003 02:42:57 GMT
On Fri, 25 Jul 2003 10:59:52 +0200 (MEST), I wrote:

> I guess that should be okay for the lookahead, right?  I suppose it 
> doesn't
> matter when r->filename is absolute, but I think it causes an infinite 
> loop
> with (say) "/../dir/" -> "dir/" and then that doubles itself each time 
> it goes
> through ap_make_full_path().

Well, I think this is slightly nicer because it uses subreq_ok() instead...

--- mod_rewrite.c.orig  Mon Jul 28 12:25:56 2003
+++ mod_rewrite.c       Mon Jul 28 12:30:48 2003
@@ -3813,17 +3813,9 @@
     }

 #define LOOKAHEAD(subrecfunc) \
-        if ( \
-          /* filename is safe to use */ \
-          r->filename != NULL \
-              /* - and we're either not in a subrequest */ \
-              && ( r->main == NULL \
-                  /* - or in a subrequest where paths are non-NULL... */ \
-                    || ( r->main->uri != NULL && r->uri != NULL \
-                        /*   ...and sub and main paths differ */ \
-                        && strcmp(r->main->uri, r->uri) != 0))) { \
-            /* process a file-based subrequest */ \
-            rsub = subrecfunc(r->filename, r); \
+        if (subreq_ok(r)) { \
+            /* process a subrequest */ \
+            rsub = subrecfunc("", r); \
             /* now recursively lookup the variable in the sub_req */ \
             result = lookup_variable(rsub, var+5); \
             /* copy it up to our scope before we destroy sub_req's pool */ \
@@ -3831,8 +3823,8 @@
             /* cleanup by destroying the subrequest */ \
             ap_destroy_sub_req(rsub); \
             /* log it */ \
-            rewritelog(r, 5, "lookahead: path=%s var=%s -> val=%s", \
-                       r->filename, var+5, result); \
+            rewritelog(r, 5, "lookahead: var=%s -> val=%s", \
+                       var+5, result); \
             /* return ourself to prevent re-pstrdup */ \
             return (char *)result; \
         }



Thanks.



Mime
View raw message