httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@engelschall.com (Ralf S. Engelschall)
Subject [PATCH] <Directory /foo/bar> & mod_rewrite
Date Wed, 16 Apr 1997 13:40:16 GMT

Currently I fixed another bug. A config like

   <Directory /foo/bar>
   RewriteEngine on
   RewriteBase /url/for/foo/bar
   RewriteRule ...
   </Directory>

failed for mod_rewrite. The reason was that the rewriting engine assumes that
in perdir-context the directory always has a trailing slash (as the directory
walking for .htaccess files provide). But when the perdir-context was provided
by <Directory..> the directory name is taken as plain text. So, if a trailing
slash was missing, the rewriting engine failed.

Below is a patch for mod_rewrite which makes sure that the rewriting engine
really always can operate on directories with a trailing slash.

Sidenotes:

   1. According to our recent discussions about voting I vote with +1 ;-) 

   2. I thought the group already agreed now on giving me access to 
      the repository, too. Same access as the others already have. But it
      seems this was ignored, again. I still don't have a "rse" account on the
      machine which can access the repository and there is still no "rse"
      entry in the CVS access file. What is the reason?
      I'm still waiting for this to happen!
      Still want to apply the patches myself after voting, including changes
      to CHANGES, too.

Greetings,
                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com

*** mod_rewrite.c.orig  Tue Apr 15 18:05:21 1997
--- mod_rewrite.c   Wed Apr 16 15:25:37 1997
***************
*** 61,67 ****
  **  |_| |_| |_|\___/ \__,_|___|_|  \___| \_/\_/ |_|  |_|\__\___|
  **                       |_____|
  **
! **  URL Rewriting Module, Version 3.0.4 (15-Apr-1997)
  **
  **  This module uses a rule-based rewriting engine (based on a
  **  regular-expression parser) to rewrite requested URLs on the fly. 
--- 61,67 ----
  **  |_| |_| |_|\___/ \__,_|___|_|  \___| \_/\_/ |_|  |_|\__\___|
  **                       |_____|
  **
! **  URL Rewriting Module, Version 3.0.5 (16-Apr-1997)
  **
  **  This module uses a rule-based rewriting engine (based on a
  **  regular-expression parser) to rewrite requested URLs on the fly. 
***************
*** 309,318 ****
  
      a->state           = ENGINE_DISABLED;
      a->options         = OPTION_NONE;
-     a->directory       = pstrdup(p, path);
      a->baseurl         = NULL;
      a->rewriteconds    = make_array(p, 2, sizeof(rewritecond_entry));
      a->rewriterules    = make_array(p, 2, sizeof(rewriterule_entry));
  
      return (void *)a;
  }
--- 309,327 ----
  
      a->state           = ENGINE_DISABLED;
      a->options         = OPTION_NONE;
      a->baseurl         = NULL;
      a->rewriteconds    = make_array(p, 2, sizeof(rewritecond_entry));
      a->rewriterules    = make_array(p, 2, sizeof(rewriterule_entry));
+ 
+     if (path == NULL)
+         a->directory = NULL;
+     else {
+         /* make sure it has a trailing slash */
+         if (path[strlen(path)-1] == '/')
+             a->directory = pstrdup(p, path);
+         else
+             a->directory = pstrcat(p, path, "/", NULL);
+     }
  
      return (void *)a;
  }
*** mod_rewrite.h.orig  Tue Apr 15 18:05:21 1997
--- mod_rewrite.h   Wed Apr 16 15:23:55 1997
***************
*** 64,70 ****
  **  |_| |_| |_|\___/ \__,_|___|_|  \___| \_/\_/ |_|  |_|\__\___|
  **                       |_____|
  **
! **  URL Rewriting Module, Version 3.0.4 (17-Apr-1997)
  **
  **  This module uses a rule-based rewriting engine (based on a
  **  regular-expression parser) to rewrite requested URLs on the fly. 
--- 64,70 ----
  **  |_| |_| |_|\___/ \__,_|___|_|  \___| \_/\_/ |_|  |_|\__\___|
  **                       |_____|
  **
! **  URL Rewriting Module, Version 3.0.5 (16-Apr-1997)
  **
  **  This module uses a rule-based rewriting engine (based on a
  **  regular-expression parser) to rewrite requested URLs on the fly. 

Mime
View raw message