httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Erenkrantz <jerenkra...@apache.org>
Subject [PATCH] Make default_handler handle all requests
Date Thu, 13 Jun 2002 18:19:13 GMT
According to rbb on IRC, default_handler should always accept
all requests and it alone generates the appropriate HTTP error
codes.  I gave up arguing with him about this because I wasn't
getting anywhere and we were arguing about the placement of
code rather than what the code should do.  So, here's a
patch - untested.  I'll let the hordes test and commit it.

This would fix the 500 vs. 501 case where mod_autoindex refuses to
serve a request and default_handler returns DECLINED rather than
checking it for HTTP-compliance.

This reverts all of the changes to default_handler to only have it
serve 'default-handler' requests and delays checking for APR_DIR
until we know that we have a good method.  As a side-effect,
serving a directory that falls to default_handler would now
return 404 instead of 500 (which is probably better).  -- justin

Index: server/core.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/core.c,v
retrieving revision 1.183
diff -u -r1.183 core.c
--- server/core.c	12 Jun 2002 23:59:31 -0000	1.183
+++ server/core.c	13 Jun 2002 18:07:00 -0000
@@ -3176,19 +3176,6 @@
      */
     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)
@@ -3209,6 +3196,15 @@
         if (r->finfo.filetype == 0) {
             ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
                           "File does not exist: %s", r->filename);
+            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;
         }
 

Mime
View raw message