From 4db278ffc817bdac49cc38811a95598b589505b7 Mon Sep 17 00:00:00 2001 From: Ryan Bloom Date: Sat, 15 Jun 2002 05:49:06 +0000 Subject: [PATCH] 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. 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 | 5 +++++ server/core.c | 22 +++++++++------------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/CHANGES b/CHANGES index d2d8665d31..b0e8e47218 100644 --- 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] diff --git a/server/core.c b/server/core.c index 037454b0dc..901a6f0c69 100644 --- a/server/core.c +++ b/server/core.c @@ -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) { -- 2.50.1