httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gst...@apache.org
Subject cvs commit: httpd-2.0/modules/dav/main mod_dav.c
Date Fri, 06 Sep 2002 00:26:10 GMT
gstein      2002/09/05 17:26:10

  Modified:    modules/dav/main mod_dav.c
  Log:
  Simplify mod_dav's handler.
  
  The old mechanism would jam a handler name in whenever DAV was
  configured for a directory. i.e. there weren't really any tests other
  than "is DAV handling this directory?" The name was just a marker
  which was tested later.
  
  The new mechanism simplies performs the test right in the handler.
  This is now possible since all handlers are called (before, you *had*
  to set your own name so that your handler would be called). Since the
  test is actually quite straightforward, we actually gain overall: no
  more fixups hook, and a couple integer comparisons (rather than a
  string compare).
  
  And hoo... the code is simpler, too.
  
  This code has been verified with "litmus 0.8", my own little
  regression script, and some hand testing of static pages and CGIs. DAV
  continues to work, and it doesn't appear that the changes interfered
  with other operation.
  
  Revision  Changes    Path
  1.87      +32 -58    httpd-2.0/modules/dav/main/mod_dav.c
  
  Index: mod_dav.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/dav/main/mod_dav.c,v
  retrieving revision 1.86
  retrieving revision 1.87
  diff -u -r1.86 -r1.87
  --- mod_dav.c	5 Sep 2002 06:26:07 -0000	1.86
  +++ mod_dav.c	6 Sep 2002 00:26:10 -0000	1.87
  @@ -818,7 +818,7 @@
       return DONE;
   }
   
  -/* validate resource on POST, then pass it off to the default handler */
  +/* validate resource/locks on POST, then pass to the default handler */
   static int dav_method_post(request_rec *r)
   {
       dav_resource *resource;
  @@ -4423,21 +4423,45 @@
    */
   static int dav_handler(request_rec *r)
   {
  -    dav_dir_conf *conf;
  +    dav_dir_conf *conf = ap_get_module_config(r->per_dir_config, &dav_module);
   
  -    if (strcmp(r->handler, "dav-handler")) {
  +    /* if DAV is not enabled, then we've got nothing to do */
  +    if (conf->provider == NULL) {
           return DECLINED;
       }
   
  +    if (r->method_number == M_GET) {
  +        /*
  +         * ### need some work to pull Content-Type and Content-Language
  +         * ### from the property database.
  +         */
  +
  +        /*
  +         * If the repository hasn't indicated that it will handle the
  +         * GET method, then just punt.
  +         *
  +         * ### this isn't quite right... taking over the response can break
  +         * ### things like mod_negotiation. need to look into this some more.
  +         */
  +        if (!conf->provider->repos->handle_get) {
  +            return DECLINED;
  +        }
  +    }
  +
  +    /* ### do we need to do anything with r->proxyreq ?? */
  +
       /* quickly ignore any HTTP/0.9 requests which aren't subreqs. */
       if (r->assbackwards && !r->main) {
           return DECLINED;
       }
   
  -    /* ### do we need to do anything with r->proxyreq ?? */
  -
  -    conf = (dav_dir_conf *)ap_get_module_config(r->per_dir_config,
  -                                                &dav_module);
  +    /*
  +     * ### anything else to do here? could another module and/or
  +     * ### config option "take over" the handler here? i.e. how do
  +     * ### we lock down this hierarchy so that we are the ultimate
  +     * ### arbiter? (or do we simply depend on the administrator
  +     * ### to avoid conflicting configurations?)
  +     */
   
       /*
        * Set up the methods mask, since that's one of the reasons this handler
  @@ -4486,8 +4510,6 @@
        * ### also, there is the issue with other methods (see ISSUES)
        */
   
  -    /* ### more work necessary, now that we have M_foo for DAV methods */
  -
       /* dispatch the appropriate method handler */
       if (r->method_number == M_GET) {
           return dav_method_get(r);
  @@ -4581,6 +4603,7 @@
           return dav_method_merge(r);
       }
   
  +    /* BIND method */
       if (r->method_number == dav_methods[DAV_M_BIND]) {
           return dav_method_bind(r);
       }
  @@ -4595,59 +4618,10 @@
       return DECLINED;
   }
   
  -static int dav_fixups(request_rec *r)
  -{
  -    dav_dir_conf *conf;
  -
  -    conf = (dav_dir_conf *)ap_get_module_config(r->per_dir_config,
  -                                                &dav_module);
  -
  -    /* if DAV is not enabled, then we've got nothing to do */
  -    if (conf->provider == NULL) {
  -        return DECLINED;
  -    }
  -
  -    if (r->method_number == M_GET) {
  -        /*
  -         * ### need some work to pull Content-Type and Content-Language
  -         * ### from the property database.
  -         */
  -
  -        /*
  -         * If the repository hasn't indicated that it will handle the
  -         * GET method, then just punt.
  -         *
  -         * ### this isn't quite right... taking over the response can break
  -         * ### things like mod_negotiation. need to look into this some more.
  -         */
  -        if (!conf->provider->repos->handle_get) {
  -            return DECLINED;
  -        }
  -    }
  -
  -    /* ### we should (instead) trap the ones that we DO understand */
  -    /* ### the handler DOES handle POST, so we need to fix one of these */
  -    if (r->method_number != M_POST) {
  -
  -        /*
  -         * ### anything else to do here? could another module and/or
  -         * ### config option "take over" the handler here? i.e. how do
  -         * ### we lock down this hierarchy so that we are the ultimate
  -         * ### arbiter? (or do we simply depend on the administrator
  -         * ### to avoid conflicting configurations?)
  -         */
  -        r->handler = "dav-handler";
  -        return OK;
  -    }
  -
  -    return DECLINED;
  -}
  -
   static void register_hooks(apr_pool_t *p)
   {
       ap_hook_handler(dav_handler, NULL, NULL, APR_HOOK_MIDDLE);
       ap_hook_post_config(dav_init_handler, NULL, NULL, APR_HOOK_MIDDLE);
  -    ap_hook_fixups(dav_fixups, NULL, NULL, APR_HOOK_MIDDLE);
   
       dav_hook_find_liveprop(dav_core_find_liveprop, NULL, NULL, APR_HOOK_LAST);
       dav_hook_insert_all_liveprops(dav_core_insert_all_liveprops,
  
  
  

Mime
View raw message