]> granicus.if.org Git - apache/commitdiff
The test of filename[0] == '/' is very evil ;)
authorWilliam A. Rowe Jr <wrowe@apache.org>
Sun, 21 Oct 2001 17:48:21 +0000 (17:48 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Sun, 21 Oct 2001 17:48:21 +0000 (17:48 +0000)
  More patches required to;

    1. use apr_filepath_merge rather than apr_pstrcat for creating proper
       and canonical paths.

    2. untangle the proxy: fooness that no longer works in directory_walk.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91622 13f79535-47bb-0310-9956-ffa450edef68

modules/mappers/mod_rewrite.c

index b37fdf0fb3f4bb826c414cfbd3d9f37818c172b2..e35319a7d97265abeb5f0e5938f7a036c4d898a1 100644 (file)
@@ -1222,8 +1222,8 @@ static int hook_uri2file(request_rec *r)
 #endif
             rewritelog(r, 2, "local path result: %s", r->filename);
 
-            /* the filename has to start with a slash! */
-            if (r->filename[0] != '/') {
+            /* the filename must be an absolute path! */
+            if (!ap_os_is_path_absolute(r->pool, r->filename)) {
                 return HTTP_BAD_REQUEST;
             }
 
@@ -1508,7 +1508,7 @@ static int hook_fixup(request_rec *r)
             }
 
             /* the filename has to start with a slash! */
-            if (r->filename[0] != '/') {
+            if (!ap_os_is_path_absolute(r->pool, r->filename)) {
                 return HTTP_BAD_REQUEST;
             }
 
@@ -1990,7 +1990,7 @@ static int apply_rewrite_rule(request_rec *r, rewriterule_entry *p,
      *   location, i.e. if it's not starting with either a slash
      *   or a fully qualified URL scheme.
      */
-    if (prefixstrip && r->filename[0] != '/'
+    if (prefixstrip && !ap_os_is_path_absolute(r->pool, r->filename)
        && !is_absolute_uri(r->filename)) {
         rewritelog(r, 3, "[per-dir %s] add per-dir prefix: %s -> %s%s",
                    perdir, r->filename, perdir, r->filename);
@@ -2077,7 +2077,7 @@ static int apply_rewrite_rule(request_rec *r, rewriterule_entry *p,
      *  not start with a slash. Here we add again the initially
      *  stripped per-directory prefix.
      */
-    if (prefixstrip && r->filename[0] != '/') {
+    if (prefixstrip && !ap_os_is_path_absolute(r->pool, r->filename)) {
         rewritelog(r, 3, "[per-dir %s] add per-dir prefix: %s -> %s%s",
                    perdir, r->filename, perdir, r->filename);
         r->filename = apr_pstrcat(r->pool, perdir, r->filename, NULL);