You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Jeff Trawick <tr...@attglobal.net> on 2002/01/29 01:33:30 UTC
[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...
Re: [PATCH] default_handler tries to serve directories :)
Posted by "William A. Rowe, Jr." <wr...@covalent.net>.
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" <tr...@attglobal.net>
To: <de...@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...
>
Re: [PATCH] default_handler tries to serve directories :)
Posted by "William A. Rowe, Jr." <wr...@covalent.net>.
In 1.3 mod_dir was a handler. Now it happens as an early internal_fast_redirect
in the fixup (?) phase.
What happens if nobody redirects [mod_dir failed]? Probably is falling
on the default handler.
This is fine if the default handler croaks [would that be NOT AUTHORIZED
or NOT FOUND?] The only way to get here is
. mod_dir finds nothing
. mod_autoindex isn't enabled/loaded.
If nobody cares until we hit the core handler, I suggest it must be NOT FOUND.
So your patch in the last post is right.
----- Original Message -----
From: "Jeff Trawick" <tr...@attglobal.net>
To: <de...@httpd.apache.org>
Sent: Monday, January 28, 2002 7:54 PM
Subject: Re: [PATCH] default_handler tries to serve directories :)
> Jeff Trawick <tr...@attglobal.net> writes:
>
> > I have a very minimal config file with no mod_autoindex that reacts
> > strangely to an HTTP 0.9 GET for /.
>
> For reasons I don't understand, a request from IE (configured for
> HTTP/1.1) to GET / is attempting to use all available paging space :)
> I'll try to understand that soon-ish.
>
> (That's without the patch posted previously.)
>
> > Here is a silly patch. For now I'm filtering out APR_DIR files.
> > WW1D? ("1" == "1.3")
>
> I don't see any code to filter out directories, but I must admit that
> I didn't try it with 1.3 to see what would happen.
>
> --
> Jeff Trawick | trawick@attglobal.net | PGP public key at web site:
> http://www.geocities.com/SiliconValley/Park/9289/
> Born in Roswell... married an alien...
>
Re: [PATCH] default_handler tries to serve directories :)
Posted by Jeff Trawick <tr...@attglobal.net>.
Jeff Trawick <tr...@attglobal.net> writes:
> I have a very minimal config file with no mod_autoindex that reacts
> strangely to an HTTP 0.9 GET for /.
For reasons I don't understand, a request from IE (configured for
HTTP/1.1) to GET / is attempting to use all available paging space :)
I'll try to understand that soon-ish.
(That's without the patch posted previously.)
> Here is a silly patch. For now I'm filtering out APR_DIR files.
> WW1D? ("1" == "1.3")
I don't see any code to filter out directories, but I must admit that
I didn't try it with 1.3 to see what would happen.
--
Jeff Trawick | trawick@attglobal.net | PGP public key at web site:
http://www.geocities.com/SiliconValley/Park/9289/
Born in Roswell... married an alien...