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 2001/02/21 02:04:40 UTC

cvs commit: httpd-2.0/modules/mappers mod_dir.c

rbb         01/02/20 17:04:40

  Modified:    .        CHANGES
               modules/mappers mod_dir.c
  Log:
  Make mod_dir use a fixup for sending a redirect to the browser.
  Before this, we were using a handler, which doesn't make much
  sense, because the handler wasn't generating any data, it would
  either return a redirect error code, or DECLINED.  This fits the
  current hooks better.
  Submitted by:	Ryan Morgan <rm...@covalent.net>
  
  Revision  Changes    Path
  1.100     +6 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.99
  retrieving revision 1.100
  diff -u -d -b -w -u -r1.99 -r1.100
  --- CHANGES	2001/02/20 20:50:05	1.99
  +++ CHANGES	2001/02/21 01:04:39	1.100
  @@ -1,5 +1,11 @@
   Changes with Apache 2.0.12-dev
   
  +  *) Make mod_dir use a fixup for sending a redirect to the browser.
  +     Before this, we were using a handler, which doesn't make much
  +     sense, because the handler wasn't generating any data, it would
  +     either return a redirect error code, or DECLINED.  This fits the
  +     current hooks better.  [Ryan Morgan <rm...@covalent.net>]
  +
     *) Make the threaded MPM use APR threads instead of pthreads.
        [Ryan Bloom]
   
  
  
  
  1.29      +3 -4      httpd-2.0/modules/mappers/mod_dir.c
  
  Index: mod_dir.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_dir.c,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -d -b -w -u -r1.28 -r1.29
  --- mod_dir.c	2001/02/16 04:26:40	1.28
  +++ mod_dir.c	2001/02/21 01:04:39	1.29
  @@ -124,8 +124,9 @@
       int num_names;
       int error_notfound = 0;
   
  -    if(strcmp(r->handler,DIR_MAGIC_TYPE))
  +    if (r->finfo.filetype != APR_DIR) {
   	return DECLINED;
  +    }
   
       d = (dir_config_rec *) ap_get_module_config(r->per_dir_config,
   						&dir_module);
  @@ -223,9 +224,7 @@
   
   static void register_hooks(apr_pool_t *p)
   {
  -    static const char * const aszSucc[]={ "mod_autoindex.c", NULL };
  -
  -    ap_hook_handler(handle_dir,NULL,aszSucc,APR_HOOK_MIDDLE);
  +    ap_hook_fixups(handle_dir,NULL,NULL,APR_HOOK_MIDDLE);
   }
   
   module AP_MODULE_DECLARE_DATA dir_module = {
  
  
  

Re: cvs commit: httpd-2.0/modules/mappers mod_dir.c

Posted by rb...@covalent.net.
On Wed, 21 Feb 2001, Greg Stein wrote:

> On Wed, Feb 21, 2001 at 12:37:54AM -0800, Ryan Morgan wrote:
> >
> > I don't think this change is going to work because mod_dir does more
> > than just check if a redirect is going to be needed.  It also handles
> > the sending of index files.  This means that with this change running
> > ap_sub_req_* could result in a index file being sent, which is not the
> > correct behavior.
> >
> > The sending of the index file still needs to be implemented as a handler.
> > I would suggest that we either back this change out, or move the uri
> > checking into to fixups phase to allow subrequests to determine if the
> > request will generate a HTTP_MOVED_PERMANANTLY response.  A patch is
> > attached, only minimally tested since an update of my tree has resulted
> > in undefined references to pthread_sigmask.
>
> Seems fine to me!

I see what was missed now.  There is an internal_redirect() in that
function.  I'll fix this right now.

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Re: cvs commit: httpd-2.0/modules/mappers mod_dir.c

Posted by Greg Stein <gs...@lyra.org>.
On Wed, Feb 21, 2001 at 12:37:54AM -0800, Ryan Morgan wrote:
> 
> I don't think this change is going to work because mod_dir does more
> than just check if a redirect is going to be needed.  It also handles
> the sending of index files.  This means that with this change running
> ap_sub_req_* could result in a index file being sent, which is not the
> correct behavior.
> 
> The sending of the index file still needs to be implemented as a handler.
> I would suggest that we either back this change out, or move the uri
> checking into to fixups phase to allow subrequests to determine if the
> request will generate a HTTP_MOVED_PERMANANTLY response.  A patch is
> attached, only minimally tested since an update of my tree has resulted
> in undefined references to pthread_sigmask.

Seems fine to me!

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Re: cvs commit: httpd-2.0/modules/mappers mod_dir.c

Posted by Ryan Morgan <rm...@covalent.net>.
I don't think this change is going to work because mod_dir does more
than just check if a redirect is going to be needed.  It also handles
the sending of index files.  This means that with this change running
ap_sub_req_* could result in a index file being sent, which is not the
correct behavior.

The sending of the index file still needs to be implemented as a handler.
I would suggest that we either back this change out, or move the uri
checking into to fixups phase to allow subrequests to determine if the
request will generate a HTTP_MOVED_PERMANANTLY response.  A patch is
attached, only minimally tested since an update of my tree has resulted
in undefined references to pthread_sigmask.

-Ryan

>   Index: CHANGES
>   ===================================================================
>   RCS file: /home/cvs/httpd-2.0/CHANGES,v
>   retrieving revision 1.99
>   retrieving revision 1.100
>   diff -u -d -b -w -u -r1.99 -r1.100
>   --- CHANGES	2001/02/20 20:50:05	1.99
>   +++ CHANGES	2001/02/21 01:04:39	1.100
>   @@ -1,5 +1,11 @@
>    Changes with Apache 2.0.12-dev
>    
>   +  *) Make mod_dir use a fixup for sending a redirect to the browser.
>   +     Before this, we were using a handler, which doesn't make much
>   +     sense, because the handler wasn't generating any data, it would
>   +     either return a redirect error code, or DECLINED.  This fits the
>   +     current hooks better.  [Ryan Morgan <rm...@covalent.net>]
>   +
>      *) Make the threaded MPM use APR threads instead of pthreads.
>         [Ryan Bloom]
>    
>   
>   
>   
>   1.29      +3 -4      httpd-2.0/modules/mappers/mod_dir.c
>   
>   Index: mod_dir.c
>   ===================================================================
>   RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_dir.c,v
>   retrieving revision 1.28
>   retrieving revision 1.29
>   diff -u -d -b -w -u -r1.28 -r1.29
>   --- mod_dir.c	2001/02/16 04:26:40	1.28
>   +++ mod_dir.c	2001/02/21 01:04:39	1.29
>   @@ -124,8 +124,9 @@
>        int num_names;
>        int error_notfound = 0;
>    
>   -    if(strcmp(r->handler,DIR_MAGIC_TYPE))
>   +    if (r->finfo.filetype != APR_DIR) {
>    	return DECLINED;
>   +    }
>    
>        d = (dir_config_rec *) ap_get_module_config(r->per_dir_config,
>    						&dir_module);
>   @@ -223,9 +224,7 @@
>    
>    static void register_hooks(apr_pool_t *p)
>    {
>   -    static const char * const aszSucc[]={ "mod_autoindex.c", NULL };
>   -
>   -    ap_hook_handler(handle_dir,NULL,aszSucc,APR_HOOK_MIDDLE);
>   +    ap_hook_fixups(handle_dir,NULL,NULL,APR_HOOK_MIDDLE);
>    }
>    
>    module AP_MODULE_DECLARE_DATA dir_module = {