From 0f0bc6e3d7330c1446dfba2ffdcad96e1f49a89e Mon Sep 17 00:00:00 2001 From: Jeff Trawick Date: Fri, 15 Mar 2002 13:35:42 +0000 Subject: [PATCH] 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 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93952 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 5 +++++ server/request.c | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/CHANGES b/CHANGES index 89e633e1f9..1a90943431 100644 --- 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 ] diff --git a/server/request.c b/server/request.c index b3d024ceb3..ac3748612d 100644 --- a/server/request.c +++ b/server/request.c @@ -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) { -- 2.40.0