You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@apache.org on 2002/06/15 07:49:06 UTC

cvs commit: httpd-2.0/server core.c

rbb         2002/06/14 22:49:06

  Modified:    .        CHANGES
               server   core.c
  Log:
  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
  
  Revision  Changes    Path
  1.832     +5 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.831
  retrieving revision 1.832
  diff -u -r1.831 -r1.832
  --- CHANGES	15 Jun 2002 05:41:48 -0000	1.831
  +++ CHANGES	15 Jun 2002 05:49:05 -0000	1.832
  @@ -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]
   
  
  
  
  1.184     +9 -13     httpd-2.0/server/core.c
  
  Index: core.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/core.c,v
  retrieving revision 1.183
  retrieving revision 1.184
  diff -u -r1.183 -r1.184
  --- core.c	12 Jun 2002 23:59:31 -0000	1.183
  +++ core.c	15 Jun 2002 05:49:06 -0000	1.184
  @@ -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;
           }
   
  
  
  

Re: cvs commit: httpd-2.0/server core.c

Posted by rb...@apache.org.
On 15 Jun 2002 rbb@apache.org wrote:

> rbb         2002/06/14 22:49:06
> 
>   Modified:    .        CHANGES
>                server   core.c
>   Log:
>   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

Just to clarify.  There was a comment in PR 8045 that returning 500 was
better than 404 if a directory exists, but there is no index.  I
completely disagree.  Users see a 500, and they get scared.  IMO, a 404
means that we could not find a valid response, which is this case
exactly.  Plus, this matches what we did in 1.3, and users expect it.

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
550 Jean St
Oakland CA 94610
-------------------------------------------------------------------------------


Re: cvs commit: httpd-2.0/server core.c

Posted by rb...@apache.org.
On 15 Jun 2002 rbb@apache.org wrote:

> rbb         2002/06/14 22:49:06
> 
>   Modified:    .        CHANGES
>                server   core.c
>   Log:
>   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

Just to clarify.  There was a comment in PR 8045 that returning 500 was
better than 404 if a directory exists, but there is no index.  I
completely disagree.  Users see a 500, and they get scared.  IMO, a 404
means that we could not find a valid response, which is this case
exactly.  Plus, this matches what we did in 1.3, and users expect it.

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
550 Jean St
Oakland CA 94610
-------------------------------------------------------------------------------