]> granicus.if.org Git - apache/commitdiff
Allow URIs specifying CGI scripts to include '/' at the end
authorJeff Trawick <trawick@apache.org>
Fri, 15 Mar 2002 13:35:42 +0000 (13:35 +0000)
committerJeff Trawick <trawick@apache.org>
Fri, 15 Mar 2002 13:35:42 +0000 (13:35 +0000)
(e.g., /cgi-bin/printenv/) on AIX and Solaris (and other OSs
which ignore '/' at the end of the names of non-directories).

PR:    10138

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

CHANGES
server/request.c

diff --git a/CHANGES b/CHANGES
index 89e633e1f90860235759d8f5ee38440300d14aaa..1a90943431313660d1f7d0e42346c63d06f5eb8b 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,10 @@
 Changes with Apache 2.0.34-dev
 
+  *) Allow URIs specifying CGI scripts to include '/' at the end
+     (e.g., /cgi-bin/printenv/) on AIX and Solaris (and other OSs
+     which ignore '/' at the end of the names of non-directories).
+     PR 10138  [Jeff Trawick]
+
   *) implement SSLSessionCache shmht and shmcb based on apr_rmm and
      apr_shm.  [Madhusudan Mathihalli <madhusudan_mathihalli@hp.com>]
 
index b3d024ceb38982eb346bc4a309e1b6e1dd05f06f..ac3748612d9771b53ef96b74f7029d862ab2eecc 100644 (file)
@@ -556,6 +556,20 @@ AP_DECLARE(int) ap_directory_walk(request_rec *r)
      */
     if (!r->finfo.filetype || r->finfo.filetype == APR_LNK) {
         apr_stat(&r->finfo, r->filename, APR_FINFO_MIN, r->pool);
+
+        /* some OSs will return APR_SUCCESS/APR_REG if we stat
+         * a regular file but we have '/' at the end of the name;
+         *
+         * other OSs will return APR_ENOTDIR for that situation;
+         *
+         * handle it the same everywhere by simulating a failure
+         * if it looks like a directory but really isn't
+         */
+        if (r->finfo.filetype &&
+            r->finfo.filetype != APR_DIR &&
+            r->filename[strlen(r->filename) - 1] == '/') {
+            r->finfo.filetype = 0; /* forget what we learned */
+        }
     }
 
     if (r->finfo.filetype == APR_REG) {