httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gst...@locus.apache.org
Subject cvs commit: apache-2.0/src/modules/dav/main mod_dav.c mod_dav.h util.c util_lock.c
Date Thu, 09 Nov 2000 13:08:06 GMT
gstein      00/11/09 05:08:06

  Modified:    src/modules/dav/fs repos.c
               src/modules/dav/main mod_dav.c mod_dav.h util.c util_lock.c
  Log:
  final round of walker cleanup: fix the provider API to match what is Right.
  
  Revision  Changes    Path
  1.27      +16 -18    apache-2.0/src/modules/dav/fs/repos.c
  
  Index: repos.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/dav/fs/repos.c,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- repos.c	2000/11/09 12:48:17	1.26
  +++ repos.c	2000/11/09 13:08:05	1.27
  @@ -208,7 +208,8 @@
   };
   
   /* forward declaration for internal treewalkers */
  -static dav_error * dav_fs_walk(dav_walker_ctx *wctx, int depth);
  +static dav_error * dav_fs_walk(const dav_walk_params *params, int depth,
  +                               dav_response **response);
   static dav_error * dav_fs_internal_walk(const dav_walk_params *params,
                                           int depth, int is_move,
                                           const dav_resource *root_dst,
  @@ -1251,23 +1252,24 @@
        * including the state dirs
        */
       if (resource->collection) {
  -	dav_walker_ctx ctx = { { 0 } };
  +        dav_walk_params params = { 0 };
   	dav_error *err = NULL;
  +        dav_response *multi_status;
   
  -	ctx.w.walk_type = (DAV_WALKTYPE_NORMAL
  -                           | DAV_WALKTYPE_HIDDEN
  -                           | DAV_WALKTYPE_POSTFIX);
  -	ctx.w.func = dav_fs_delete_walker;
  -        ctx.w.walk_ctx = &ctx;
  -	ctx.w.pool = info->pool;
  -	ctx.w.root = resource;
  +	params.walk_type = (DAV_WALKTYPE_NORMAL
  +                            | DAV_WALKTYPE_HIDDEN
  +                            | DAV_WALKTYPE_POSTFIX);
  +	params.func = dav_fs_delete_walker;
  +	params.pool = info->pool;
  +	params.root = resource;
   
  -	if ((err = dav_fs_walk(&ctx, DAV_INFINITY)) != NULL) {
  +	if ((err = dav_fs_walk(&params, DAV_INFINITY,
  +                               &multi_status)) != NULL) {
               /* on a "real" error, then just punt. nothing else to do. */
               return err;
           }
   
  -        if ((*response = ctx.response) != NULL) {
  +        if ((*response = multi_status) != NULL) {
               /* some multistatus responses exist. wrap them in a 207 */
               return dav_new_error(info->pool, HTTP_MULTI_STATUS, 0,
                                    "Error(s) occurred on some resources during "
  @@ -1648,15 +1650,11 @@
       return err;
   }
   
  -static dav_error * dav_fs_walk(dav_walker_ctx *wctx, int depth)
  +static dav_error * dav_fs_walk(const dav_walk_params *params, int depth,
  +                               dav_response **response)
   {
  -    dav_response *response;
  -    dav_error *err;
  -
       /* always return the error, and any/all multistatus responses */
  -    err = dav_fs_internal_walk(&wctx->w, depth, 0, NULL, &response);
  -    wctx->response = response;
  -    return err;
  +    return dav_fs_internal_walk(params, depth, 0, NULL, response);
   }
   
   /* dav_fs_etag:  Stolen from ap_make_etag.  Creates a strong etag
  
  
  
  1.28      +4 -3      apache-2.0/src/modules/dav/main/mod_dav.c
  
  Index: mod_dav.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/dav/main/mod_dav.c,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- mod_dav.c	2000/11/09 11:23:39	1.27
  +++ mod_dav.c	2000/11/09 13:08:06	1.28
  @@ -1531,6 +1531,7 @@
       ap_xml_doc *doc;
       const ap_xml_elem *child;
       dav_walker_ctx ctx = { { 0 } };
  +    dav_response *multi_status;
   
       /* Ask repository module to resolve the resource */
       result = dav_get_resource(r, 1 /*target_allowed*/, NULL, &resource);
  @@ -1622,7 +1623,7 @@
   	ctx.w.walk_type |= DAV_WALKTYPE_LOCKNULL;
       }
   
  -    err = (*resource->hooks->walk)(&ctx, depth);
  +    err = (*resource->hooks->walk)(&ctx.w, depth, &multi_status);
   
       if (ctx.w.lockdb != NULL) {
   	(*ctx.w.lockdb->hooks->close_lockdb)(ctx.w.lockdb);
  @@ -1641,11 +1642,11 @@
        * scope for the badprops. */
       /* NOTE: propstat_404 != NULL implies doc != NULL */
       if (ctx.propstat_404 != NULL) {
  -	dav_send_multistatus(r, HTTP_MULTI_STATUS, ctx.response,
  +	dav_send_multistatus(r, HTTP_MULTI_STATUS, multi_status,
                                doc->namespaces);
       }
       else {
  -	dav_send_multistatus(r, HTTP_MULTI_STATUS, ctx.response, NULL);
  +	dav_send_multistatus(r, HTTP_MULTI_STATUS, multi_status, NULL);
       }
   
       /* the response has been sent. */
  
  
  
  1.24      +9 -9      apache-2.0/src/modules/dav/main/mod_dav.h
  
  Index: mod_dav.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/dav/main/mod_dav.h,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- mod_dav.h	2000/11/09 12:48:17	1.23
  +++ mod_dav.h	2000/11/09 13:08:06	1.24
  @@ -1267,10 +1267,7 @@
       /* input: */
       dav_walk_params w;
   
  -    /* output: */
  -    dav_response *response;
   
  -
       /* ### client data... phasing out this big glom */
   
       request_rec *r;			/* original request */
  @@ -1529,14 +1526,17 @@
   
       /* Walk a resource hierarchy.
        *
  -     * Iterates over the resource hierarchy specified by wctx->resource.
  -     * Parameter for control of the walk and the callback are specified
  -     * by wctx.
  +     * Iterates over the resource hierarchy specified by params->root.
  +     * Control of the walk and the callback are specified by 'params'.
        *
  -     * An HTTP_* status code is returned if an error occurs during the
  -     * walk or the callback indicates an error. OK is returned on success.
  +     * An error may be returned. *response will contain multistatus
  +     * responses (if any) suitable for the body of the error. It is also
  +     * possible to return NULL, yet still have multistatus responses.
  +     * In this case, typically the caller should return a 207 (Multistatus)
  +     * and the responses (in the body) as the HTTP response.
        */
  -    dav_error * (*walk)(dav_walker_ctx *wctx, int depth);
  +    dav_error * (*walk)(const dav_walk_params *params, int depth,
  +                        dav_response **response);
   
       /* Get the entity tag for a resource */
       const char * (*getetag)(const dav_resource *resource);
  
  
  
  1.13      +3 -2      apache-2.0/src/modules/dav/main/util.c
  
  Index: util.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/dav/main/util.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- util.c	2000/11/09 11:23:39	1.12
  +++ util.c	2000/11/09 13:08:06	1.13
  @@ -1314,6 +1314,7 @@
       /* (1) Validate the specified resource, at the specified depth */
       if (resource->exists && depth > 0) {
           dav_walker_ctx ctx = { { 0 } };
  +        dav_response *multi_status;
   
   	ctx.w.walk_type = DAV_WALKTYPE_NORMAL;
   	ctx.w.func = dav_validate_walker;
  @@ -1330,9 +1331,9 @@
   	    ctx.w.walk_type |= DAV_WALKTYPE_LOCKNULL;
   	}
   
  -	err = (*repos_hooks->walk)(&ctx, DAV_INFINITY);
  +	err = (*repos_hooks->walk)(&ctx.w, DAV_INFINITY, &multi_status);
   	if (err == NULL) {
  -            *response = ctx.response;
  +            *response = multi_status;;
   	}
           /* else: implies a 5xx status code occurred. */
       }
  
  
  
  1.11      +10 -5     apache-2.0/src/modules/dav/main/util_lock.c
  
  Index: util_lock.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/dav/main/util_lock.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- util_lock.c	2000/11/09 11:56:26	1.10
  +++ util_lock.c	2000/11/09 13:08:06	1.11
  @@ -356,6 +356,7 @@
       if (depth > 0) {
   	/* Walk existing collection and set indirect locks */
           dav_walker_ctx ctx = { { 0 } };
  +        dav_response *multi_status;
   
   	ctx.w.walk_type = DAV_WALKTYPE_NORMAL | DAV_WALKTYPE_AUTH;
   	ctx.w.func = dav_lock_walker;
  @@ -367,15 +368,15 @@
   	ctx.r = r;
   	ctx.lock = lock;
   
  -	err = (*resource->hooks->walk)(&ctx, DAV_INFINITY);
  +	err = (*resource->hooks->walk)(&ctx.w, DAV_INFINITY, &multi_status);
   	if (err != NULL) {
   	    /* implies a 5xx status code occurred. screw the multistatus */
   	    return err;
   	}
   
  -	if (ctx.response != NULL) {
  +	if (multi_status != NULL) {
   	    /* manufacture a 207 error for the multistatus response */
  -	    *response = ctx.response;
  +	    *response = multi_status;
   	    return dav_new_error(r->pool, HTTP_MULTI_STATUS, 0,
   				 "Error(s) occurred on resources during the "
   				 "addition of a depth lock.");
  @@ -556,6 +557,7 @@
   
       if (lock_resource->collection) {
           dav_walker_ctx ctx = { { 0 } };
  +        dav_response *multi_status;
   
   	ctx.w.walk_type = DAV_WALKTYPE_NORMAL | DAV_WALKTYPE_LOCKNULL;
   	ctx.w.func = dav_unlock_walker;
  @@ -567,9 +569,10 @@
   	ctx.r = r;
   	ctx.locktoken = locktoken;
   
  -	err = (*repos_hooks->walk)(&ctx, DAV_INFINITY);
  +	err = (*repos_hooks->walk)(&ctx.w, DAV_INFINITY, &multi_status);
   
   	/* ### fix this! */
  +        /* ### do something with multi_status */
   	result = err == NULL ? OK : err->status;
       }
       else
  @@ -614,6 +617,7 @@
       dav_lock *prev;
       dav_walker_ctx ctx = { { 0 } };
       const dav_hooks_repository *repos_hooks = resource->hooks;
  +    dav_response *multi_status;
   
       if (use_parent) {
   	which_resource = (*repos_hooks->get_parent_resource)(resource);
  @@ -677,7 +681,8 @@
       ctx.lock = locks;
       ctx.skip_root = !use_parent;
   
  -    return (*repos_hooks->walk)(&ctx, DAV_INFINITY);
  +    /* ### do something with multi_status */
  +    return (*repos_hooks->walk)(&ctx.w, DAV_INFINITY, &multi_status);
   }
   
   /* ---------------------------------------------------------------
  
  
  

Mime
View raw message