]> granicus.if.org Git - apache/commitdiff
Make the default_handler catch all requests that aren't served by
authorRyan Bloom <rbb@apache.org>
Sat, 15 Jun 2002 05:49:06 +0000 (05:49 +0000)
committerRyan Bloom <rbb@apache.org>
Sat, 15 Jun 2002 05:49:06 +0000 (05:49 +0000)
another handler.  This also gets us to return a 404 if a directory
is requested, there is no DirectoryIndex, and mod_autoindex isn't
loaded.

PR: 8045
Submitted by: Justin Erenkrantz

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

CHANGES
server/core.c

diff --git a/CHANGES b/CHANGES
index d2d8665d31e418d791d1475a5d06908bae02ed37..b0e8e47218470a38cfebccf43ca51378c742b85a 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,10 @@
 Changes with Apache 2.0.38
 
+  *) Make the default_handler catch all requests that aren't served by
+     another handler.  This also gets us to return a 404 if a directory
+     is requested, there is no DirectoryIndex, and mod_autoindex isn't
+     loaded.  [Justin Erenkrantz]
+
   *) Fixed the handling of nested if-statements in shtml files.
      PR 9866  [Brian Pane]
 
index 037454b0dcdbd754b49ee143ca7bd482463cdd4e..901a6f0c6986a7548f76d370f37ee45f0e5bef71 100644 (file)
@@ -3176,19 +3176,6 @@ static int default_handler(request_rec *r)
      */
     int bld_content_md5;
 
-    /*
-     * The old way of doing handlers meant that this handler would
-     * match literally anything - this way will require handler to
-     * have a / in the middle, which probably captures the original
-     * intent, but may cause problems at first - Ben 7th Jan 01
-     * Don't try to serve a dir.  Some OSs do weird things with
-     * raw I/O on a dir.
-     */
-    if ((strcmp(r->handler, "default-handler")
-        && !ap_strchr_c(r->handler, '/'))
-        || r->finfo.filetype == APR_DIR)
-        return DECLINED;
-
     d = (core_dir_config *)ap_get_module_config(r->per_dir_config,
                                                 &core_module);
     bld_content_md5 = (d->content_md5 & 1)
@@ -3212,6 +3199,15 @@ static int default_handler(request_rec *r)
             return HTTP_NOT_FOUND;
         }
 
+        /* Don't try to serve a dir.  Some OSs do weird things with
+         * raw I/O on a dir.
+         */
+        if (r->finfo.filetype == APR_DIR) {
+            ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+                          "Attempt to serve directory: %s", r->filename);
+            return HTTP_NOT_FOUND;
+        }
+
         if ((r->used_path_info != AP_REQ_ACCEPT_PATH_INFO) &&
             r->path_info && *r->path_info)
         {