httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@covalent.net>
Subject Re: [PATCH] default_handler tries to serve directories :)
Date Tue, 29 Jan 2002 02:45:10 GMT
Better yet - we could even set the error status within the fixup, if we
register the handler 'very last' and we are still the handler (no handler
or handler==us :-)  But yes - we should simply test for APR_DIR.

Bill


----- Original Message ----- 
From: "Jeff Trawick" <trawick@attglobal.net>
To: <dev@httpd.apache.org>
Sent: Monday, January 28, 2002 6:33 PM
Subject: [PATCH] default_handler tries to serve directories :)


> I have a very minimal config file with no mod_autoindex that reacts
> strangely to an HTTP 0.9 GET for /.
> 
> On AIX, I get back the raw contents of the directory file (gibberish).
> It turns out that default_handler opened the htdocs directory via
> apr_file_open()/open() which caused the raw directory to be returned.
> On Linux, I get a 500 error and I/O errors in the log (I guess Linux
> doesn't like normal I/O on directories :) ).
> 
> r->finfo.filetype is APR_DIR.  r->handler is httpd/unix-directory.
> 
> Why don't we decline if filetype is APR_DIR?  (Conceivably it could be
> useful to read from some of the other filetypes?)
> 
> Here is a silly patch.  For now I'm filtering out APR_DIR files.
> WW1D?  ("1" == "1.3")
> 
> Index: server/core.c
> ===================================================================
> RCS file: /home/cvs/httpd-2.0/server/core.c,v
> retrieving revision 1.138
> diff -u -r1.138 core.c
> --- server/core.c 27 Jan 2002 12:52:07 -0000 1.138
> +++ server/core.c 29 Jan 2002 00:29:43 -0000
> @@ -2900,8 +2900,9 @@
>       * have a / in the middle, which probably captures the original
>       * intent, but may cause problems at first - Ben 7th Jan 01
>       */
> -    if (strcmp(r->handler, "default-handler")
> -        && !ap_strchr_c(r->handler, '/'))
> +    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,
> 
> Now the client should portably get a 500 error.  Better yet, error_log
> has 
> 
> [warn] [client 127.0.0.1] handler "httpd/unix-directory" not found for: /tmp/xxx/htdocs/
> 
> On Linux, it did have
> 
> [error] (21)Is a directory: core_output_filter: Error reading from bucket.
> [info] (22)Invalid argument: core_output_filter: writing data to the network
> 
> -- 
> Jeff Trawick | trawick@attglobal.net | PGP public key at web site:
>        http://www.geocities.com/SiliconValley/Park/9289/
>              Born in Roswell... married an alien...
> 


Mime
View raw message