httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <gst...@lyra.org>
Subject cvs changes tonite
Date Thu, 23 Nov 2000 13:16:59 GMT
Since the automatic mail for CVS commits is currently busted, and I've
done a bunch of work, I figured it would be a good idea to foward those
changes to this list.

Note: this is simply extracted from:
    /home/cvs/CVSROOT/commitlogs/apache-2.0

This is a bunch of commit emails all pasted together...

*) bunch o' DAV work
*) patch up the ap_sub_req_* calls for the "next filter" arg

Cheers,
-g

----
gstein      00/11/23 02:08:20

  Modified:    src/modules/dav/main mod_dav.c util.c
  Log:
  *) fix subtle crasher in COPY method
  *) update sub-request-creation calls to include new "next filter" arg
  
  Revision  Changes    Path
  1.31      +2 -2      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.30
  retrieving revision 1.31
  diff -u -u -r1.30 -r1.31
  --- mod_dav.c	2000/11/16 07:13:43	1.30
  +++ mod_dav.c	2000/11/23 10:08:19	1.31
  @@ -774,7 +774,7 @@
   	pathname = ap_os_case_canonical_filename(r->pool, pathname);
   
   	/* Create a sub-request with the new filename */
  -	new_req = ap_sub_req_lookup_file(pathname, r);
  +	new_req = ap_sub_req_lookup_file(pathname, r, NULL);
   	if (new_req == NULL) {
   	    (*resource->hooks->free_file)(fhandle);
   	    return HTTP_INTERNAL_SERVER_ERROR;
  @@ -2077,7 +2077,7 @@
   static int dav_method_copymove(request_rec *r, int is_move)
   {
       dav_resource *resource;
  -    dav_auto_version_info src_av_info;
  +    dav_auto_version_info src_av_info = { 0 };
       dav_resource *resnew;
       dav_auto_version_info dst_av_info;
       const char *body;
  
  
  
  1.15      +1 -1      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.14
  retrieving revision 1.15
  diff -u -u -r1.14 -r1.15
  --- util.c	2000/11/15 02:05:12	1.14
  +++ util.c	2000/11/23 10:08:19	1.15
  @@ -275,7 +275,7 @@
        * same HTTP method on the destination. This allows the destination
        * to apply appropriate restrictions (e.g. readonly).
        */
  -    result.rnew = ap_sub_req_method_uri(r->method, new_file, r);
  +    result.rnew = ap_sub_req_method_uri(r->method, new_file, r, NULL);
   
       return result;
   }
  
  
  


gstein      00/11/23 02:37:01

  Modified:    src/modules/dav/fs repos.c
               src/modules/dav/main liveprop.c mod_dav.h props.c
  Log:
  More revamping of live properties. Focused around the fact that a provider's
  hooks are only called if that provider defines the prop (e.g. NOTME return
  values are no longer needed). Also refactored some code to simplify liveprop
  management for providers (assuming they don't have "funny" stuff).
  
  *) enumerate all known DAV properties (DAV_PROPID_* in mod_dav.h)
     - use these in fs/repos.c rather than DAV_PROPID_FS_*
     - will use in SVN and a second-round whack on the "core" props in props.c
  *) refactor dav_fs_liveprop_name to dav_liveprop_spec and add a writeable
     flag
  *) add dav_liveprop_group to hold a number of "top-level" items to pass to
     the new liveprop utility functions
  *) add dav_do_find_liveprop() as a util for the find_liveprop hook function
     - toss repos.c::dav_fs_find_prop
     - use the new function for repos.c::dav_fs_find_liveprop
  *) rebuild dav_register_liveprop_namespace() as a full "group" registration
     which will handle all the namespaces in a liveprop provider. The new func
     is called dav_register_liveprop_group().
  *) add dav_get_liveprop_info() to look up liveprop info given a provider's
     propid. used in dav_fs_insert_prop() and dav_fs_is_writeable()
  *) fold dav_fs_insert_all() directly into dav_fs_insert_all_liveprops()
     since the former wasn't called by anything else
  *) rename var in dav_fs_insert_prop() to "global_ns" to clarify its purpose.
     torch a couple out-of-date comments in there.
  *) toss dav_prop_rw type and simplify is_writeable hook. fix up calling of
     hook in props.c::dav_rw_liveprop(). dav_rw_liveprop() should also call
     the provider *first*, if one has stated it is handling the property.
  *) toss DAV_PROP_INSERT_NOTME since we can't call a provider's insert_prop
     with somebody else's liveprop
  *) remove DAV_IS_CORE_PROP() in props.c. a core prop is not defined by its
     propid, but by provider==NULL. add comments to clarify when that happens.
  *) fix sub-request creation to include new next-filter arg
  
  Revision  Changes    Path
  1.32      +107 -138  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.31
  retrieving revision 1.32
  diff -u -u -r1.31 -r1.32
  --- repos.c	2000/11/22 10:54:54	1.31
  +++ repos.c	2000/11/23 10:36:59	1.32
  @@ -128,8 +128,9 @@
   /* pull this in from the other source file */
   extern const dav_hooks_locks dav_hooks_locks_fs;
   
  -/* forward-declare this sucker */
  +/* forward-declare the hook structures */
   static const dav_hooks_repository dav_hooks_repository_fs;
  +static const dav_hooks_liveprop dav_hooks_liveprop_fs;
   
   /*
   ** The namespace URIs that we use. This list and the enumeration must
  @@ -148,48 +149,69 @@
   };
   
   /*
  -** The properties that we define.
  +** The single property that we define (in the DAV_FS_URI_MYPROPS namespace)
   */
  -enum {
  -    /* using DAV_FS_URI_DAV */
  -    DAV_PROPID_FS_creationdate = DAV_PROPID_FS,
  -    DAV_PROPID_FS_displayname,
  -    DAV_PROPID_FS_getcontentlength,
  -    DAV_PROPID_FS_getetag,
  -    DAV_PROPID_FS_getlastmodified,
  -    DAV_PROPID_FS_source,
  -
  -    /* using DAV_FS_URI_MYPROPS */
  -    DAV_PROPID_FS_executable
  -};
  -/* NOTE: the magic "200" is derived from the ranges in mod_dav.h */
  -#define DAV_PROPID_FS_OURS(id)	(DAV_PROPID_FS <= (id) && \
  -				 (id) < DAV_PROPID_FS + 200)
  +#define DAV_PROPID_FS_executable        1
   
  -typedef struct {
  -    int ns;
  -    const char * name;
  -
  -    int propid;
  -} dav_fs_liveprop_name;
  -
  -static const dav_fs_liveprop_name dav_fs_props[] =
  +static const dav_liveprop_spec dav_fs_props[] =
   {
  -    { DAV_FS_URI_DAV,     "creationdate",     DAV_PROPID_FS_creationdate },
  -    { DAV_FS_URI_DAV,     "getcontentlength", DAV_PROPID_FS_getcontentlength },
  -    { DAV_FS_URI_DAV,     "getetag",          DAV_PROPID_FS_getetag },
  -    { DAV_FS_URI_DAV,     "getlastmodified",  DAV_PROPID_FS_getlastmodified },
  +    {
  +        DAV_FS_URI_DAV,
  +        "creationdate",
  +        DAV_PROPID_creationdate,
  +        0
  +    },
  +    {
  +        DAV_FS_URI_DAV,
  +        "getcontentlength",
  +        DAV_PROPID_getcontentlength,
  +        0
  +    },
  +    {
  +        DAV_FS_URI_DAV,
  +        "getetag",
  +        DAV_PROPID_getetag,
  +        0
  +    },
  +    {
  +        DAV_FS_URI_DAV,
  +        "getlastmodified",
  +        DAV_PROPID_getlastmodified,
  +        0
  +    },
   
  -    { DAV_FS_URI_MYPROPS, "executable",       DAV_PROPID_FS_executable },
  +    {
  +        DAV_FS_URI_MYPROPS,
  +        "executable",
  +        DAV_PROPID_FS_executable,
  +        0       /* handled special in dav_fs_is_writeable */
  +    },
         
       /* ### these aren't FS specific */
  -    { DAV_FS_URI_DAV,     "displayname",      DAV_PROPID_FS_displayname },
  -    { DAV_FS_URI_DAV,     "source",           DAV_PROPID_FS_source },
  +    {
  +        DAV_FS_URI_DAV,
  +        "displayname",
  +        DAV_PROPID_displayname,
  +        1,
  +    },
  +    {
  +        DAV_FS_URI_DAV,
  +        "source",
  +        DAV_PROPID_source,
  +        1,
  +    },
   
       { 0 }	/* sentinel */
   };
   
  +static const dav_liveprop_group dav_fs_liveprop_group =
  +{
  +    dav_fs_props,
  +    dav_fs_namespace_uris,
  +    &dav_hooks_liveprop_fs
  +};
   
  +
   /* define the dav_stream structure for our use */
   struct dav_stream {
       apr_pool_t *p;
  @@ -1694,30 +1716,6 @@
       dav_fs_getetag,
   };
   
  -static int dav_fs_find_prop(const char *ns_uri, const char *name)
  -{
  -    const dav_fs_liveprop_name *scan;
  -    int ns;
  -
  -    if (*ns_uri == 'h'
  -	&& strcmp(ns_uri, dav_fs_namespace_uris[DAV_FS_URI_MYPROPS]) == 0) {
  -	ns = DAV_FS_URI_MYPROPS;
  -    }
  -    else if (*ns_uri == 'D' && strcmp(ns_uri, "DAV:") == 0) {
  -	ns = DAV_FS_URI_DAV;
  -    }
  -    else {
  -	/* we don't define this property */
  -	return 0;
  -    }
  -
  -    for (scan = dav_fs_props; scan->name != NULL; ++scan)
  -	if (ns == scan->ns && strcmp(name, scan->name) == 0)
  -	    return scan->propid;
  -
  -    return 0;
  -}
  -
   static dav_prop_insert dav_fs_insert_prop(const dav_resource *resource,
   					  int propid, int insvalue,
   					  ap_text_header *phdr)
  @@ -1726,16 +1724,13 @@
       const char *s;
       dav_prop_insert which;
       apr_pool_t *p = resource->info->pool;
  -    const dav_fs_liveprop_name *scan;
  -    int ns;
  +    const dav_liveprop_spec *info;
  +    int global_ns;
   
       /* an HTTP-date can be 29 chars plus a null term */
       /* a 64-bit size can be 20 chars plus a null term */
       char buf[DAV_TIMEBUF_SIZE];
   
  -    if (!DAV_PROPID_FS_OURS(propid))
  -	return DAV_PROP_INSERT_NOTME;
  -
       /*
       ** None of FS provider properties are defined if the resource does not
       ** exist. Just bail for this case.
  @@ -1745,14 +1740,14 @@
       ** look there for the value.
       **
       ** Even though we state that the FS properties are not defined, the
  -    ** client cannot store dead values -- we deny that thru the is_writable
  +    ** client cannot store dead values -- we deny that thru the is_writeable
       ** hook function.
       */
       if (!resource->exists)
   	return DAV_PROP_INSERT_NOTDEF;
   
       switch (propid) {
  -    case DAV_PROPID_FS_creationdate:
  +    case DAV_PROPID_creationdate:
   	/*
   	** Closest thing to a creation date. since we don't actually
   	** perform the operations that would modify ctime (after we
  @@ -1764,7 +1759,7 @@
   	value = buf;
   	break;
   
  -    case DAV_PROPID_FS_getcontentlength:
  +    case DAV_PROPID_getcontentlength:
   	/* our property, but not defined on collection resources */
   	if (resource->collection)
   	    return DAV_PROP_INSERT_NOTDEF;
  @@ -1773,11 +1768,11 @@
   	value = buf;
   	break;
   
  -    case DAV_PROPID_FS_getetag:
  +    case DAV_PROPID_getetag:
   	value = dav_fs_getetag(resource);
   	break;
   
  -    case DAV_PROPID_FS_getlastmodified:
  +    case DAV_PROPID_getlastmodified:
   	dav_format_time(DAV_STYLE_RFC822,
                           resource->info->finfo.mtime,
                           buf);
  @@ -1801,8 +1796,8 @@
   	break;
   #endif /* WIN32 */
   
  -    case DAV_PROPID_FS_displayname:
  -    case DAV_PROPID_FS_source:
  +    case DAV_PROPID_displayname:
  +    case DAV_PROPID_source:
       default:
   	/*
   	** This property is not defined. However, it may be a dead
  @@ -1813,26 +1808,20 @@
   
       /* assert: value != NULL */
   
  -    for (scan = dav_fs_props; scan->name != NULL; ++scan)
  -	if (scan->propid == propid)
  -	    break;
  +    /* get the information and global NS index for the property */
  +    global_ns = dav_get_liveprop_info(propid, &dav_fs_liveprop_group, &info);
   
  -    /* assert: scan->name != NULL */
  +    /* assert: info != NULL && info->name != NULL */
   
  -    /* map our namespace into a global NS index */
  -    ns = dav_get_liveprop_ns_index(dav_fs_namespace_uris[scan->ns]);
  -
       /* DBG3("FS: inserting lp%d:%s  (local %d)", ns, scan->name, scan->ns); */
   
       if (insvalue) {
  -	/* use D: prefix to refer to the DAV: namespace URI */
   	s = apr_psprintf(p, "<lp%d:%s>%s</lp%d:%s>" DEBUG_CR,
  -			ns, scan->name, value, ns, scan->name);
  +                         global_ns, info->name, value, global_ns, info->name);
   	which = DAV_PROP_INSERT_VALUE;
       }
       else {
  -	/* use D: prefix to refer to the DAV: namespace URI */
  -	s = apr_psprintf(p, "<lp%d:%s/>" DEBUG_CR, ns, scan->name);
  +	s = apr_psprintf(p, "<lp%d:%s/>" DEBUG_CR, global_ns, info->name);
   	which = DAV_PROP_INSERT_NAME;
       }
       ap_text_append(p, phdr, s);
  @@ -1840,58 +1829,19 @@
       /* we inserted a name or value (this prop is done) */
       return which;
   }
  -
  -static void dav_fs_insert_all(const dav_resource *resource, int insvalue,
  -			      ap_text_header *phdr)
  -{
  -    if (!resource->exists) {
  -	/* a lock-null resource */
  -	/*
  -	** ### technically, we should insert empty properties. dunno offhand
  -	** ### what part of the spec said this, but it was essentially thus:
  -	** ### "the properties should be defined, but may have no value".
  -	*/
  -	return;
  -    }
  -
  -    (void) dav_fs_insert_prop(resource, DAV_PROPID_FS_creationdate,
  -			      insvalue, phdr);
  -    (void) dav_fs_insert_prop(resource, DAV_PROPID_FS_getcontentlength,
  -			      insvalue, phdr);
  -    (void) dav_fs_insert_prop(resource, DAV_PROPID_FS_getlastmodified,
  -			      insvalue, phdr);
  -    (void) dav_fs_insert_prop(resource, DAV_PROPID_FS_getetag,
  -			      insvalue, phdr);
  -
  -#ifndef WIN32
  -    /*
  -    ** Note: this property is not defined on the Win32 platform.
  -    **       dav_fs_insert_prop() won't insert it, but we may as
  -    **       well not even call it.
  -    */
  -    (void) dav_fs_insert_prop(resource, DAV_PROPID_FS_executable,
  -			      insvalue, phdr);
  -#endif
  -
  -    /* ### we know the others aren't defined as liveprops */
  -}
   
  -static dav_prop_rw dav_fs_is_writeable(const dav_resource *resource,
  -				       int propid)
  +static int dav_fs_is_writeable(const dav_resource *resource, int propid)
   {
  -    if (!DAV_PROPID_FS_OURS(propid))
  -	return DAV_PROP_RW_NOTME;
  +    const dav_liveprop_spec *info;
   
  -    if (propid == DAV_PROPID_FS_displayname
  -	|| propid == DAV_PROPID_FS_source
   #ifndef WIN32
  -        /* this property is not usable (writeable) on the Win32 platform */
  -	|| (propid == DAV_PROPID_FS_executable && !resource->collection)
  +    /* this property is not usable (writeable) on the Win32 platform */
  +    if (propid == DAV_PROPID_FS_executable && !resource->collection)
  +	return 1;
   #endif
  -	)
  -	return DAV_PROP_RW_YES;
   
  -    return DAV_PROP_RW_NO;
  +    (void) dav_get_liveprop_info(propid, &dav_fs_liveprop_group, &info);
  +    return info->is_writable;
   }
   
   static dav_error *dav_fs_patch_validate(const dav_resource *resource,
  @@ -2061,29 +2011,48 @@
   int dav_fs_find_liveprop(request_rec *r, const char *ns_uri, const char *name,
                            const dav_hooks_liveprop **hooks)
   {
  -    int propid = dav_fs_find_prop(ns_uri, name);
  -
  -    if (propid == 0)
  -        return 0;
  -
  -    *hooks = &dav_hooks_liveprop_fs;
  -    return propid;
  +    return dav_do_find_liveprop(ns_uri, name, &dav_fs_liveprop_group, hooks);
   }
   
   void dav_fs_insert_all_liveprops(request_rec *r, const dav_resource *resource,
                                    int insvalue, ap_text_header *phdr)
   {
  -    dav_fs_insert_all(resource, insvalue, phdr);
  +    if (!resource->exists) {
  +	/* a lock-null resource */
  +	/*
  +	** ### technically, we should insert empty properties. dunno offhand
  +	** ### what part of the spec said this, but it was essentially thus:
  +	** ### "the properties should be defined, but may have no value".
  +	*/
  +	return;
  +    }
  +
  +    (void) dav_fs_insert_prop(resource, DAV_PROPID_creationdate,
  +			      insvalue, phdr);
  +    (void) dav_fs_insert_prop(resource, DAV_PROPID_getcontentlength,
  +			      insvalue, phdr);
  +    (void) dav_fs_insert_prop(resource, DAV_PROPID_getlastmodified,
  +			      insvalue, phdr);
  +    (void) dav_fs_insert_prop(resource, DAV_PROPID_getetag,
  +			      insvalue, phdr);
  +
  +#ifndef WIN32
  +    /*
  +    ** Note: this property is not defined on the Win32 platform.
  +    **       dav_fs_insert_prop() won't insert it, but we may as
  +    **       well not even call it.
  +    */
  +    (void) dav_fs_insert_prop(resource, DAV_PROPID_FS_executable,
  +			      insvalue, phdr);
  +#endif
  +
  +    /* ### we know the others aren't defined as liveprops */
   }
   
   void dav_fs_register(apr_pool_t *p)
   {
       /* register the namespace URIs */
  -    const char * const * uris = dav_fs_namespace_uris;
  -
  -    for ( ; *uris != NULL; ++uris) {
  -        dav_register_liveprop_namespace(p, *uris);
  -    }
  +    dav_register_liveprop_group(p, &dav_fs_liveprop_group);
   
       /* register the repository provider */
       dav_register_provider(p, "filesystem", &dav_fs_provider);
  
  
  
  1.6       +60 -2     apache-2.0/src/modules/dav/main/liveprop.c
  
  Index: liveprop.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/dav/main/liveprop.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -u -r1.5 -r1.6
  --- liveprop.c	2000/10/16 02:58:15	1.5
  +++ liveprop.c	2000/11/23 10:37:00	1.6
  @@ -74,8 +74,7 @@
       return APR_SUCCESS;
   }
   
  -DAV_DECLARE(void) dav_register_liveprop_namespace(apr_pool_t *p, 
  -                                                  const char *uri)
  +static void dav_register_liveprop_namespace(apr_pool_t *p, const char *uri)
   {
       int value;
   
  @@ -121,5 +120,64 @@
   
           s = apr_psprintf(p, " xmlns:lp%d=\"%s\"", (int)val, key);
           ap_text_append(p, phdr, s);
  +    }
  +}
  +
  +DAV_DECLARE(int) dav_do_find_liveprop(const char *ns_uri, const char *name,
  +                                      const dav_liveprop_group *group,
  +                                      const dav_hooks_liveprop **hooks)
  +{
  +    const char * const *uris = group->namespace_uris;
  +    const dav_liveprop_spec *scan;
  +    int ns;
  +
  +    /* first: locate the namespace in the namespace table */
  +    for (ns = 0; uris[ns] != NULL; ++ns)
  +        if (strcmp(ns_uri, uris[ns]) == 0)
  +            break;
  +    if (uris[ns] == NULL) {
  +	/* not our property (the namespace matched none of ours) */
  +	return 0;
  +    }
  +
  +    /* second: look for the property in the liveprop specs */
  +    for (scan = group->specs; scan->name != NULL; ++scan)
  +	if (ns == scan->ns && strcmp(name, scan->name) == 0) {
  +            *hooks = group->hooks;
  +	    return scan->propid;
  +        }
  +
  +    /* not our property (same namespace, but no matching prop name) */
  +    return 0;
  +}
  +
  +DAV_DECLARE(int) dav_get_liveprop_info(int propid,
  +                                       const dav_liveprop_group *group,
  +                                       const dav_liveprop_spec **info)
  +{
  +    const dav_liveprop_spec *scan;
  +
  +    for (scan = group->specs; scan->name != NULL; ++scan) {
  +        if (scan->propid == propid) {
  +            *info = scan;
  +
  +            /* map the provider-local NS into a global NS index */
  +            return dav_get_liveprop_ns_index(group->namespace_uris[scan->ns]);
  +        }
  +    }
  +
  +    /* assert: should not reach this point */
  +    *info = NULL;
  +    return 0;
  +}
  +
  +DAV_DECLARE(void) dav_register_liveprop_group(apr_pool_t *p, 
  +                                              const dav_liveprop_group *group)
  +{
  +    /* register the namespace URIs */
  +    const char * const * uris = group->namespace_uris;
  +
  +    for ( ; *uris != NULL; ++uris) {
  +        dav_register_liveprop_namespace(p, *uris);
       }
   }
  
  
  
  1.28      +135 -20   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.27
  retrieving revision 1.28
  diff -u -u -r1.27 -r1.28
  --- mod_dav.h	2000/11/19 02:13:55	1.27
  +++ mod_dav.h	2000/11/23 10:37:00	1.28
  @@ -581,12 +581,6 @@
                                           const dav_provider *hooks);
   const dav_provider * dav_lookup_provider(const char *name);
   
  -DAV_DECLARE(void) dav_register_liveprop_namespace(apr_pool_t *pool, 
  -                                                  const char *uri);
  -DAV_DECLARE(int) dav_get_liveprop_ns_index(const char *uri);
  -int dav_get_liveprop_ns_count(void);
  -void dav_add_all_liveprop_xmlns(apr_pool_t *p, ap_text_header *phdr);
  -
   
   /* ### deprecated */
   #define DAV_GET_HOOKS_PROPDB(r)         dav_get_propdb_hooks(r)
  @@ -666,7 +660,6 @@
   */
   
   typedef enum {
  -    DAV_PROP_INSERT_NOTME,	/* prop not defined by this provider */
       DAV_PROP_INSERT_NOTDEF,	/* property is defined by this provider,
   				   but nothing was inserted because the
   				   (live) property is not defined for this
  @@ -678,12 +671,6 @@
   				   into the text block */
   } dav_prop_insert;
   
  -typedef enum {
  -    DAV_PROP_RW_NOTME,		/* not my property */
  -    DAV_PROP_RW_NO,		/* property is NOT writeable */
  -    DAV_PROP_RW_YES		/* property IS writeable */
  -} dav_prop_rw;
  -
   /* opaque type for PROPPATCH rollback information */
   typedef struct dav_liveprop_rollback dav_liveprop_rollback;
   
  @@ -691,11 +678,9 @@
   {
       /*
       ** Insert a property name/value into a text block. The property to
  -    ** insert is identified by the propid value. Providers should return
  -    ** DAV_PROP_INSERT_NOTME if they do not define the specified propid.
  -    ** If insvalue is true, then the property's value should be inserted;
  -    ** otherwise, an empty element (ie. just the prop's name) should be
  -    ** inserted.
  +    ** insert is identified by the propid value. If insvalue is true,
  +    ** then the property's value should be inserted; otherwise, an empty
  +    ** element (ie. just the prop's name) should be inserted.
       **
       ** Returns one of DAV_PROP_INSERT_* based on what happened.
       **
  @@ -711,9 +696,9 @@
       ** ### we may want a different semantic. i.e. maybe it should be
       ** ### "can we write <value> into this property?"
       **
  -    ** Returns appropriate read/write status.
  +    ** Returns 1 if the live property can be written, 0 if read-only.
       */
  -    dav_prop_rw (*is_writeable)(const dav_resource *resource, int propid);
  +    int (*is_writeable)(const dav_resource *resource, int propid);
   
       /*
       ** This member defines the set of namespace URIs that the provider
  @@ -779,6 +764,136 @@
   				  int operation,
   				  void *context,
   				  dav_liveprop_rollback *rollback_ctx);
  +};
  +
  +/*
  +** dav_liveprop_spec: specify a live property
  +**
  +** This structure is used as a standard way to determine if a particular
  +** property is a live property. Its use is not part of the mandated liveprop
  +** interface, but can be used by liveprop providers in conjuction with the
  +** utility routines below.
  +*/
  +typedef struct {
  +    int ns;             /* provider-local namespace index */
  +    const char *name;   /* name of the property */
  +
  +    int propid;         /* provider-local property ID */
  +
  +    int is_writable;    /* is the property writeable? */
  +
  +} dav_liveprop_spec;
  +
  +/*
  +** dav_liveprop_group: specify a group of liveprops
  +**
  +** This structure specifies a group of live properties, their namespaces,
  +** and how to handle them.
  +*/
  +typedef struct {
  +    const dav_liveprop_spec *specs;
  +    const char * const *namespace_uris;
  +    const dav_hooks_liveprop *hooks;
  +
  +} dav_liveprop_group;
  +
  +/* ### docco */
  +DAV_DECLARE(int) dav_do_find_liveprop(const char *ns_uri, const char *name,
  +                                      const dav_liveprop_group *group,
  +                                      const dav_hooks_liveprop **hooks);
  +
  +/* ### docco */
  +DAV_DECLARE(int) dav_get_liveprop_info(int propid,
  +                                       const dav_liveprop_group *group,
  +                                       const dav_liveprop_spec **info);
  +
  +/* ### docco */
  +DAV_DECLARE(void) dav_register_liveprop_group(apr_pool_t *pool, 
  +                                              const dav_liveprop_group *group);
  +
  +/* ### docco */
  +DAV_DECLARE(int) dav_get_liveprop_ns_index(const char *uri);
  +
  +/* ### docco */
  +int dav_get_liveprop_ns_count(void);
  +
  +/* ### docco */
  +void dav_add_all_liveprop_xmlns(apr_pool_t *p, ap_text_header *phdr);
  +
  +/*
  +** Standard WebDAV Property Identifiers
  +**
  +** A live property provider does not need to use these; they are simply
  +** provided for convenience.
  +**
  +** Property identifiers need to be unique within a given provider, but not
  +** *across* providers (note: this uniqueness constraint was different in
  +** older versions of mod_dav).
  +**
  +** The identifiers start at 20000 to make it easier for providers to avoid
  +** conflicts with the standard properties. The properties are arranged
  +** alphabetically, and may be reordered from time to time (as properties
  +** are introduced).
  +**
  +** NOTE: there is no problem with reordering (e.g. binary compat) since the
  +** identifiers are only used within a given provider, which would pick up
  +** the entire set of changes upon a recompile.
  +*/
  +enum {
  +    DAV_PROPID_BEGIN = 20000,
  +
  +    /* Standard WebDAV properties (RFC 2518 and DeltaV I-D) */
  +    DAV_PROPID_comment,                         /* from DeltaV I-D */
  +    DAV_PROPID_creationdate,
  +    DAV_PROPID_creator_displayname,             /* from DeltaV I-D */
  +    DAV_PROPID_displayname,
  +    DAV_PROPID_getcontentlanguage,
  +    DAV_PROPID_getcontentlength,
  +    DAV_PROPID_getcontenttype,
  +    DAV_PROPID_getetag,
  +    DAV_PROPID_getlastmodified,
  +    DAV_PROPID_lockdiscovery,
  +    DAV_PROPID_resourcetype,
  +    DAV_PROPID_source,
  +    DAV_PROPID_supportedlock,
  +    DAV_PROPID_supported_method_set,            /* from DeltaV I-D */
  +    DAV_PROPID_supported_live_property_set,     /* from DeltaV I-D */
  +    DAV_PROPID_supported_report_set,            /* from DeltaV I-D */
  +
  +    /* DeltaV properties (from the I-D) */
  +    DAV_PROPID_activity_collection_set,
  +    DAV_PROPID_activity_set,
  +    DAV_PROPID_auto_merge_set,
  +    DAV_PROPID_auto_version,
  +    DAV_PROPID_baseline_selector,
  +    DAV_PROPID_baselined_collection,
  +    DAV_PROPID_baselined_collection_set,
  +    DAV_PROPID_checked_out,
  +    DAV_PROPID_checkin_date,
  +    DAV_PROPID_checkin_fork,
  +    DAV_PROPID_checkout_fork,
  +    DAV_PROPID_checkout_set,
  +    DAV_PROPID_current_activity_set,
  +    DAV_PROPID_current_workspace_set,
  +    DAV_PROPID_initial_version,
  +    DAV_PROPID_label_name_set,
  +    DAV_PROPID_latest_version,
  +    DAV_PROPID_merge_set,
  +    DAV_PROPID_mutable,
  +    DAV_PROPID_predecessor_set,
  +    DAV_PROPID_subactivity_set,
  +    DAV_PROPID_successor_set,
  +    DAV_PROPID_target,
  +    DAV_PROPID_unreserved,
  +    DAV_PROPID_version,
  +    DAV_PROPID_version_history,
  +    DAV_PROPID_version_name,
  +    DAV_PROPID_version_set,
  +    DAV_PROPID_workspace,
  +    DAV_PROPID_workspace_checkout_set,
  +    DAV_PROPID_workspace_collection_set,
  +
  +    DAV_PROPID_END
   };
   
   /*
  
  
  
  1.16      +17 -28    apache-2.0/src/modules/dav/main/props.c
  
  Index: props.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/dav/main/props.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -u -r1.15 -r1.16
  --- props.c	2000/11/15 02:05:12	1.15
  +++ props.c	2000/11/23 10:37:00	1.16
  @@ -271,6 +271,7 @@
   
   };
   
  +/* NOTE: dav_core_props[] and the following enum must stay in sync. */
   /* ### move these into a "core" liveprop provider? */
   static const char * const dav_core_props[] =
   {
  @@ -297,8 +298,6 @@
   
       DAV_PROPID_CORE_UNKNOWN
   };
  -#define DAV_IS_CORE_PROP(propid)	((propid) >= DAV_PROPID_CORE && \
  -					 (propid) <= DAV_PROPID_CORE_UNKNOWN)
   
   /*
   ** This structure is used to track information needed for a rollback.
  @@ -341,6 +340,7 @@
   	for (propid = DAV_PROPID_CORE; *p != NULL; ++p, ++propid)
   	    if (strcmp(elem->name, *p) == 0) {
   		priv->propid = propid;
  +                /* priv->provider == NULL */
   		return;
   	    }
   
  @@ -349,6 +349,7 @@
       else if (elem->ns == AP_XML_NS_NONE) {
   	/* policy: liveprop providers cannot define no-namespace properties */
   	priv->propid = DAV_PROPID_CORE_UNKNOWN;
  +        /* priv->provider == NULL */
   	return;
       }
   
  @@ -364,6 +365,7 @@
       }
   
       priv->propid = DAV_PROPID_CORE_UNKNOWN;
  +    /* priv->provider == NULL */
   }
   
   /* is the live property read/write? */
  @@ -371,6 +373,13 @@
   {
       int propid = priv->propid;
   
  +    /*
  +    ** Check the liveprop provider (if this is a provider-defined prop)
  +    */
  +    if (priv->provider != NULL) {
  +        return (*priv->provider->is_writeable)(propdb->resource, propid);
  +    }
  +
       /* these are defined as read-only */
       if (propid == DAV_PROPID_CORE_lockdiscovery
   	|| propid == DAV_PROPID_CORE_resourcetype
  @@ -395,21 +404,8 @@
       }
   
       /*
  -    ** Check the liveprop providers
  +    ** We don't recognize the property, so it must be dead (and writable)
       */
  -    if (priv->provider != NULL) {
  -        dav_prop_rw rw;
  -
  -        rw = (*priv->provider->is_writeable)(propdb->resource, propid);
  -        if (rw == DAV_PROP_RW_YES)
  -            return 1;
  -        if (rw == DAV_PROP_RW_NO)
  -            return 0;
  -    }
  -
  -    /*
  -    ** No provider recognized the property, so it must be dead (and writable)
  -    */
       return 1;
   }
   
  @@ -418,7 +414,8 @@
   {
       /* perform a "GET" on the resource's URI (note that the resource
          may not correspond to the current request!). */
  -    propdb->subreq = ap_sub_req_lookup_uri(propdb->resource->uri, propdb->r);
  +    propdb->subreq = ap_sub_req_lookup_uri(propdb->resource->uri, propdb->r,
  +                                           NULL);
   }
   
   static dav_error * dav_insert_coreprop(dav_propdb *propdb,
  @@ -608,23 +605,15 @@
   
       *inserted = 0;
   
  -    if (DAV_IS_CORE_PROP(priv->propid))
  +    if (priv->provider == NULL) {
  +        /* this is a "core" property that we define */
   	return dav_insert_coreprop(propdb, priv->propid, elem->name,
   				   getvals, phdr, inserted);
  +    }
   
       /* ask the provider (that defined this prop) to insert the prop */
       pi = (*priv->provider->insert_prop)(propdb->resource, priv->propid,
   					getvals, phdr);
  -#if DAV_DEBUG
  -    if (pi == DAV_PROP_INSERT_NOTME) {
  -	/* ### the provider should have returned NOTDEF, at least */
  -	return dav_new_error(propdb->p, HTTP_INTERNAL_SERVER_ERROR, 0,
  -			     "DESIGN ERROR: a liveprop provider defined "
  -			     "a property, but did not respond to the "
  -			     "insert_prop hook for it.");
  -    }
  -#endif
  -
       if (pi != DAV_PROP_INSERT_NOTDEF)
   	*inserted = 1;
   
  
  
  


gstein      00/11/23 03:44:25

  Modified:    src/modules/dav/fs repos.c
               src/modules/dav/main mod_dav.h
  Log:
  dav_resource should carry around a pool for allocations related to it
  
  Revision  Changes    Path
  1.33      +9 -1      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.32
  retrieving revision 1.33
  diff -u -u -r1.32 -r1.33
  --- repos.c	2000/11/23 10:36:59	1.32
  +++ repos.c	2000/11/23 11:44:15	1.33
  @@ -616,9 +616,11 @@
   
       /* Create private resource context descriptor */
       ctx = apr_pcalloc(r->pool, sizeof(*ctx));
  -    ctx->pool = r->pool;
       ctx->finfo = r->finfo;
   
  +    /* ### this should go away */
  +    ctx->pool = r->pool;
  +
       /* Preserve case on OSes which fold canonical filenames */
   #if 0
       /* ### not available in Apache 2.0 yet */
  @@ -647,6 +649,7 @@
       resource->type = DAV_RESOURCE_TYPE_REGULAR;
       resource->info = ctx;
       resource->hooks = &dav_hooks_repository_fs;
  +    resource->pool = r->pool;
   
       /* make sure the URI does not have a trailing "/" */
       len = strlen(r->uri);
  @@ -719,6 +722,8 @@
   
       /* Create private resource context descriptor */
       parent_ctx = apr_pcalloc(ctx->pool, sizeof(*parent_ctx));
  +
  +    /* ### this should go away */
       parent_ctx->pool = ctx->pool;
   
       dirpath = ap_make_dirstr_parent(ctx->pool, ctx->pathname);
  @@ -730,6 +735,7 @@
       parent_resource->info = parent_ctx;
       parent_resource->collection = 1;
       parent_resource->hooks = &dav_hooks_repository_fs;
  +    parent_resource->pool = resource->pool;
   
       if (resource->uri != NULL) {
           char *uri = ap_make_dirstr_parent(ctx->pool, resource->uri);
  @@ -1604,6 +1610,7 @@
       /* ### zero out versioned, working, baselined? */
   
       fsctx.res1 = *params->root;
  +    fsctx.res1.pool = params->pool;
   
       fsctx.res1.info = &fsctx.info1;
       fsctx.info1 = *params->root->info;
  @@ -1625,6 +1632,7 @@
   	fsctx.res2.exists = 0;
   	fsctx.res2.collection = 0;
           fsctx.res2.uri = NULL;          /* we don't track this */
  +        fsctx.res2.pool = params->pool;
   
   	fsctx.res2.info = &fsctx.info2;
   	fsctx.info2 = *root_dst->info;
  
  
  
  1.29      +5 -0      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.28
  retrieving revision 1.29
  diff -u -u -r1.28 -r1.29
  --- mod_dav.h	2000/11/23 10:37:00	1.28
  +++ mod_dav.h	2000/11/23 11:44:22	1.29
  @@ -393,6 +393,11 @@
   
       const dav_hooks_repository *hooks;	/* hooks used for this resource */
   
  +    /* When allocating items related specifically to this resource, the
  +       following pool should be used. Its lifetime will be at least as
  +       long as the dav_resource structure. */
  +    apr_pool_t *pool;
  +
   } dav_resource;
   
   /*
  
  
  


gstein      00/11/23 04:50:33

  Modified:    src/modules/dav/fs repos.c
               src/modules/dav/main config.m4 mod_dav.c mod_dav.h props.c
  Added:       src/modules/dav/main std_liveprop.c
  Log:
  shift some processing of "core" WebDAV properties out of the generic
  property handling code, and into a new, core liveprop handler.
  
  *) add std_liveprop.c to deal with the core DAV properties
  *) move DAV:resourcetype, DAV:supported-method-set,
     DAV:supported-live-property-set, and DAV:supported-report-set over to the
     new handler
  *) props.c::dav_get_allprops() should not look in the deadprop database for
     the DAV:resourcetype -- it is readonly, so should never be in there.
  *) strip vsn_hooks from the propdb; only the core liveprops need it now
  *) mod_dav.c: register the core liveprop hooks and URIs
  *) fs/repos.c: stripped DAV:displayname and DAV:source, in favor of letting
     the core handler deal with them.
  
  Revision  Changes    Path
  1.34      +1 -24     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.33
  retrieving revision 1.34
  diff -u -u -r1.33 -r1.34
  --- repos.c	2000/11/23 11:44:15	1.33
  +++ repos.c	2000/11/23 12:50:30	1.34
  @@ -186,20 +186,6 @@
           DAV_PROPID_FS_executable,
           0       /* handled special in dav_fs_is_writeable */
       },
  -      
  -    /* ### these aren't FS specific */
  -    {
  -        DAV_FS_URI_DAV,
  -        "displayname",
  -        DAV_PROPID_displayname,
  -        1,
  -    },
  -    {
  -        DAV_FS_URI_DAV,
  -        "source",
  -        DAV_PROPID_source,
  -        1,
  -    },
   
       { 0 }	/* sentinel */
   };
  @@ -1743,10 +1729,6 @@
       ** None of FS provider properties are defined if the resource does not
       ** exist. Just bail for this case.
       **
  -    ** Note that DAV:displayname and DAV:source will be stored as dead
  -    ** properties; the NOTDEF return code indicates that dav_props.c should
  -    ** look there for the value.
  -    **
       ** Even though we state that the FS properties are not defined, the
       ** client cannot store dead values -- we deny that thru the is_writeable
       ** hook function.
  @@ -1804,13 +1786,8 @@
   	break;
   #endif /* WIN32 */
   
  -    case DAV_PROPID_displayname:
  -    case DAV_PROPID_source:
       default:
  -	/*
  -	** This property is not defined. However, it may be a dead
  -	** property.
  -	*/
  +        /* ### what the heck was this property? */
   	return DAV_PROP_INSERT_NOTDEF;
       }
   
  
  
  
  1.12      +1 -1      apache-2.0/src/modules/dav/main/config.m4
  
  Index: config.m4
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/dav/main/config.m4,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -u -r1.11 -r1.12
  --- config.m4	2000/10/06 12:49:20	1.11
  +++ config.m4	2000/11/23 12:50:31	1.12
  @@ -2,7 +2,7 @@
   
   APACHE_MODPATH_INIT(dav/main)
   
  -dav_objects="mod_dav.lo props.lo util.lo util_lock.lo liveprop.lo providers.lo"
  +dav_objects="mod_dav.lo props.lo util.lo util_lock.lo liveprop.lo providers.lo std_liveprop.lo"
   
   APACHE_MODULE(dav, WebDAV protocol handling, $dav_objects, , no)
   
  
  
  
  1.32      +7 -0      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.31
  retrieving revision 1.32
  diff -u -u -r1.31 -r1.32
  --- mod_dav.c	2000/11/23 10:08:19	1.31
  +++ mod_dav.c	2000/11/23 12:50:31	1.32
  @@ -4006,6 +4006,13 @@
   {
       ap_hook_post_config(dav_init_handler, NULL, NULL, AP_HOOK_MIDDLE);
       ap_hook_type_checker(dav_type_checker, NULL, NULL, AP_HOOK_FIRST);
  +
  +    ap_hook_find_liveprop(dav_core_find_liveprop, NULL, NULL, AP_HOOK_LAST);
  +    ap_hook_insert_all_liveprops(dav_core_insert_all_liveprops,
  +                                 NULL, NULL, AP_HOOK_MIDDLE);
  +
  +    /* ### damn. need a pool. */
  +    dav_core_register_uris(NULL);
   }
   
   /*---------------------------------------------------------------------------
  
  
  
  1.30      +13 -0     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.29
  retrieving revision 1.30
  diff -u -u -r1.29 -r1.30
  --- mod_dav.h	2000/11/23 11:44:22	1.29
  +++ mod_dav.h	2000/11/23 12:50:31	1.30
  @@ -826,6 +826,19 @@
   void dav_add_all_liveprop_xmlns(apr_pool_t *p, ap_text_header *phdr);
   
   /*
  +** The following three functions are part of mod_dav's internal handling
  +** for the core WebDAV properties. They are not part of mod_dav's API.
  +*/
  +int dav_core_find_liveprop(request_rec *r, const char *ns_uri,
  +                           const char *name,
  +                           const dav_hooks_liveprop **hooks);
  +void dav_core_insert_all_liveprops(request_rec *r,
  +                                   const dav_resource *resource,
  +                                   int insvalue, ap_text_header *phdr);
  +void dav_core_register_uris(apr_pool_t *p);
  +
  +
  +/*
   ** Standard WebDAV Property Identifiers
   **
   ** A live property provider does not need to use these; they are simply
  
  
  
  1.17      +2 -114    apache-2.0/src/modules/dav/main/props.c
  
  Index: props.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/dav/main/props.c,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -u -r1.16 -r1.17
  --- props.c	2000/11/23 10:37:00	1.16
  +++ props.c	2000/11/23 12:50:31	1.17
  @@ -267,7 +267,6 @@
   
       /* hooks we should use for processing (based on the target resource) */
       const dav_hooks_db *db_hooks;
  -    const dav_hooks_vsn *vsn_hooks;
   
   };
   
  @@ -278,11 +277,7 @@
       "getcontenttype",
       "getcontentlanguage",
       "lockdiscovery",
  -    "resourcetype",
       "supportedlock",
  -    "supported-method-set",
  -    "supported-live-property-set",
  -    "supported-report-set",
   
       NULL	/* sentinel */
   };
  @@ -290,11 +285,7 @@
       DAV_PROPID_CORE_getcontenttype = DAV_PROPID_CORE,
       DAV_PROPID_CORE_getcontentlanguage,
       DAV_PROPID_CORE_lockdiscovery,
  -    DAV_PROPID_CORE_resourcetype,
       DAV_PROPID_CORE_supportedlock,
  -    DAV_PROPID_CORE_supported_method_set,
  -    DAV_PROPID_CORE_supported_live_property_set,
  -    DAV_PROPID_CORE_supported_report_set,
   
       DAV_PROPID_CORE_UNKNOWN
   };
  @@ -382,15 +373,12 @@
   
       /* these are defined as read-only */
       if (propid == DAV_PROPID_CORE_lockdiscovery
  -	|| propid == DAV_PROPID_CORE_resourcetype
   #if DAV_DISABLE_WRITEABLE_PROPS
   	|| propid == DAV_PROPID_CORE_getcontenttype
   	|| propid == DAV_PROPID_CORE_getcontentlanguage
   #endif
   	|| propid == DAV_PROPID_CORE_supportedlock
  -	|| propid == DAV_PROPID_CORE_supported_method_set
  -	|| propid == DAV_PROPID_CORE_supported_live_property_set
  -	|| propid == DAV_PROPID_CORE_supported_report_set) {
  +        ) {
   
   	return 0;
       }
  @@ -435,41 +423,6 @@
   
       switch (propid) {
   
  -    case DAV_PROPID_CORE_resourcetype:
  -        switch (propdb->resource->type) {
  -        case DAV_RESOURCE_TYPE_VERSION:
  -            if (propdb->resource->baselined) {
  -	        value = "<D:baseline/>";
  -                break;
  -            }
  -            /* fall through */
  -        case DAV_RESOURCE_TYPE_REGULAR:
  -        case DAV_RESOURCE_TYPE_WORKING:
  -            if (propdb->resource->collection) {
  -	        value = "<D:collection/>";
  -            }
  -	    else {
  -		/* ### should we denote lock-null resources? */
  -
  -		value = "";	/* becomes: <D:resourcetype/> */
  -	    }
  -            break;
  -        case DAV_RESOURCE_TYPE_HISTORY:
  -	    value = "<D:version-history/>";
  -            break;
  -        case DAV_RESOURCE_TYPE_WORKSPACE:
  -	    value = "<D:collection/>";
  -            break;
  -        case DAV_RESOURCE_TYPE_ACTIVITY:
  -	    value = "<D:activity/>";
  -            break;
  -
  -        default:
  -	    /* ### bad juju */
  -	    break;
  -        }
  -	break;
  -
       case DAV_PROPID_CORE_lockdiscovery:
           if (propdb->lockdb != NULL) {
   	    dav_lock *locks;
  @@ -507,43 +460,6 @@
           }
   	break;
   
  -    case DAV_PROPID_CORE_supported_method_set:
  -        /* ### leverage code from dav_method_options ### */
  -        break;
  -
  -    case DAV_PROPID_CORE_supported_live_property_set:
  -        /* ### insert all live property names ### */
  -        break;
  -
  -    case DAV_PROPID_CORE_supported_report_set:
  -        if (propdb->vsn_hooks != NULL) {
  -            const dav_report_elem *reports;
  -
  -            if ((err = (*propdb->vsn_hooks->avail_reports)(propdb->resource, &reports)) != NULL) {
  -	        return dav_push_error(propdb->r->pool, err->status, 0,
  -			              "DAV:supported-report-set could not be determined "
  -                                      "due to a problem fetching the available reports "
  -                                      "for this resource.",
  -			              err);
  -            }
  -
  -            if (reports == NULL)
  -                break;
  -
  -            value = "";
  -
  -            for (; reports->nmspace != NULL; ++reports) {
  -                /* Note: we presume reports->namespace is properly XML/URL quoted */
  -                char *v = apr_psprintf(propdb->p, "<%s xmlns=\"%s\"/>" DEBUG_CR,
  -                                       reports->name, reports->nmspace);
  -                /* This isn't very memory-efficient, but there should only be a small
  -                 * number of reports
  -                 */
  -                value = apr_pstrcat(propdb->p, value, v, NULL);
  -            }
  -        }
  -        break;
  -
       case DAV_PROPID_CORE_getcontenttype:
   	if (propdb->subreq == NULL) {
   	    dav_do_prop_subreq(propdb);
  @@ -1005,7 +921,6 @@
       propdb->ns_xlate = ns_xlate;
   
       propdb->db_hooks = DAV_GET_HOOKS_PROPDB(r);
  -    propdb->vsn_hooks = DAV_GET_HOOKS_VSN(r);
   
       propdb->lockdb = lockdb;
   
  @@ -1059,7 +974,6 @@
       ap_text_header hdr = { 0 };
       ap_text_header hdr_ns = { 0 };
       dav_get_props_result result = { 0 };
  -    int found_resourcetype = 0;
       int found_contenttype = 0;
       int found_contentlang = 0;
       int unused_inserted;
  @@ -1087,10 +1001,6 @@
   		goto next_key;
   
   	    /*
  -	    ** See if this is the <DAV:resourcetype> property. We need to
  -	    ** know whether it was found (and therefore, whether to supply
  -	    ** a default later).
  -	    **
   	    ** We also look for <DAV:getcontenttype> and
   	    ** <DAV:getcontentlanguage>. If they are not stored as dead
   	    ** properties, then we need to perform a subrequest to get
  @@ -1109,13 +1019,8 @@
   		else {
   		    colon = strchr(key.dptr + 2, ':');
   		}
  -
  -		if (colon[1] == 'r'
  -		    && strcmp(colon + 1, "resourcetype") == 0) {
   
  -		    found_resourcetype = 1;
  -		}
  -		else if (colon[1] == 'g') {
  +		if (colon[1] == 'g') {
   		    if (strcmp(colon + 1, "getcontenttype") == 0) {
   			found_contenttype = 1;
   		    }
  @@ -1166,23 +1071,6 @@
       (void)dav_insert_coreprop(propdb,
   			      DAV_PROPID_CORE_lockdiscovery, "lockdiscovery",
   			      getvals, &hdr, &unused_inserted);
  -    (void)dav_insert_coreprop(propdb,
  -			      DAV_PROPID_CORE_supported_method_set, "supported-method-set",
  -			      getvals, &hdr, &unused_inserted);
  -    (void)dav_insert_coreprop(propdb,
  -			      DAV_PROPID_CORE_supported_live_property_set, "supported-live-property-set",
  -			      getvals, &hdr, &unused_inserted);
  -    (void)dav_insert_coreprop(propdb,
  -			      DAV_PROPID_CORE_supported_report_set, "supported-report-set",
  -			      getvals, &hdr, &unused_inserted);
  -
  -    /* if the resourcetype wasn't stored, then prepare one */
  -    if (!found_resourcetype) {
  -	/* ### should be handling the return error here */
  -	(void)dav_insert_coreprop(propdb,
  -				  DAV_PROPID_CORE_resourcetype, "resourcetype",
  -				  getvals, &hdr, &unused_inserted);
  -    }
   
       /* if we didn't find these, then do the whole subreq thing. */
       if (!found_contenttype) {
  
  
  
  1.1                  apache-2.0/src/modules/dav/main/std_liveprop.c
  
  Index: std_liveprop.c
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #include "httpd.h"
  #include "util_xml.h"
  #include "apr_strings.h"
  
  #include "mod_dav.h"
  
  /* forward-declare */
  static const dav_hooks_liveprop dav_core_hooks_liveprop;
  
  /*
  ** The namespace URIs that we use. There will only ever be "DAV:".
  */
  static const char * const dav_core_namespace_uris[] =
  {
      "DAV:",
      NULL	/* sentinel */
  };
  
  /*
  ** Define each of the core properties that this provider will handle.
  ** Note that all of them are in the DAV: namespace, which has a
  ** provider-local index of 0.
  */
  static const dav_liveprop_spec dav_core_props[] =
  {
      { 0, "comment",              DAV_PROPID_comment,              1 },
      { 0, "creator-displayname",  DAV_PROPID_creator_displayname,  1 },
      { 0, "displayname",          DAV_PROPID_displayname,          1 },
      { 0, "resourcetype",         DAV_PROPID_resourcetype,         0 },
      { 0, "source",               DAV_PROPID_source,               1 },
      { 0, "supported-live-property-set",
        DAV_PROPID_supported_live_property_set, 0 },
      { 0, "supported-method-set", DAV_PROPID_supported_method_set, 0 },
      { 0, "supported-report-set", DAV_PROPID_supported_report_set, 0 },
  
      { 0 }	/* sentinel */
  };
  
  static const dav_liveprop_group dav_core_liveprop_group =
  {
      dav_core_props,
      dav_core_namespace_uris,
      &dav_core_hooks_liveprop
  };
  
  static dav_prop_insert dav_core_insert_prop(const dav_resource *resource,
                                              int propid, int insvalue,
                                              ap_text_header *phdr)
  {
      const char *value;
      const char *s;
      dav_prop_insert which;
      apr_pool_t *p = resource->pool;
      const dav_liveprop_spec *info;
      int global_ns;
  
      switch (propid)
      {
      case DAV_PROPID_resourcetype:
          switch (resource->type) {
          case DAV_RESOURCE_TYPE_VERSION:
              if (resource->baselined) {
  	        value = "<D:baseline/>";
                  break;
              }
              /* fall through */
          case DAV_RESOURCE_TYPE_REGULAR:
          case DAV_RESOURCE_TYPE_WORKING:
              if (resource->collection) {
  	        value = "<D:collection/>";
              }
  	    else {
  		/* ### should we denote lock-null resources? */
  
  		value = "";	/* becomes: <D:resourcetype/> */
  	    }
              break;
          case DAV_RESOURCE_TYPE_HISTORY:
  	    value = "<D:version-history/>";
              break;
          case DAV_RESOURCE_TYPE_WORKSPACE:
  	    value = "<D:collection/>";
              break;
          case DAV_RESOURCE_TYPE_ACTIVITY:
  	    value = "<D:activity/>";
              break;
  
          default:
  	    /* ### bad juju */
              return DAV_PROP_INSERT_NOTDEF;
          }
          break;
  
      case DAV_PROPID_supported_live_property_set:
          /* ### insert all live property names ### */
          break;
  
      case DAV_PROPID_supported_method_set:
          /* ### leverage code from dav_method_options ### */
          break;
  
      case DAV_PROPID_supported_report_set:
  #if 0
      {
          /* ### where to get "r" ??? */
          const dav_hooks_vsn *vsn_hooks = dav_get_vsn_hooks(r);
  
          if (vsn_hooks != NULL) {
              const dav_report_elem *reports;
              dav_error *err;
  
              if ((err = (*vsn_hooks->avail_reports)(resource,
                                                     &reports)) != NULL) {
  	        err = dav_push_error(p, err->status, 0,
                                       "DAV:supported-report-set could not "
                                       "be determined due to a problem "
                                       "fetching the available reports "
                                       "for this resource.",
                                       err);
                  /* ### can't return err... sigh. punt for now. */
                  return DAV_PROP_INSERT_NOTDEF;
              }
  
              value = "";
  
              if (reports == NULL) {
                  /* no reports are defined. break with value="" */
                  break;
              }
  
              for (; reports->nmspace != NULL; ++reports) {
                  /* Note: presume reports->namespace is XML/URL quoted */
                  const char *v = apr_psprintf(p, "<%s xmlns=\"%s\"/>" DEBUG_CR,
                                               reports->name, reports->nmspace);
  
                  /* This isn't very memory-efficient, but there should only
                     be a small number of reports */
                  value = apr_pstrcat(p, value, v, NULL);
              }
          }
          break;
      }
  #endif
      /* above code disabled. FALLTHROUGH */
  
      case DAV_PROPID_comment:
      case DAV_PROPID_creator_displayname:
      case DAV_PROPID_displayname:
      case DAV_PROPID_source:
      default:
          /*
          ** This property is known, but not defined as a liveprop. However,
          ** it may be a dead property.
          */
          return DAV_PROP_INSERT_NOTDEF;
      }
  
      /* assert: value != NULL */
  
      /* get the information and global NS index for the property */
      global_ns = dav_get_liveprop_info(propid, &dav_core_liveprop_group, &info);
  
      /* assert: info != NULL && info->name != NULL */
  
      if (insvalue) {
          s = apr_psprintf(p, "<lp%d:%s>%s</lp%d:%s>" DEBUG_CR,
                           global_ns, info->name, value, global_ns, info->name);
          which = DAV_PROP_INSERT_VALUE;
      }
      else {
          s = apr_psprintf(p, "<lp%d:%s/>" DEBUG_CR, global_ns, info->name);
          which = DAV_PROP_INSERT_NAME;
      }
      ap_text_append(p, phdr, s);
  
      /* we inserted a name or value (this prop is done) */
      return which;
  }
  
  static int dav_core_is_writable(const dav_resource *resource, int propid)
  {
      const dav_liveprop_spec *info;
  
      (void) dav_get_liveprop_info(propid, &dav_core_liveprop_group, &info);
      return info->is_writable;
  }
  
  static dav_error * dav_core_patch_validate(const dav_resource *resource,
                                             const ap_xml_elem *elem,
                                             int operation, void **context,
                                             int *defer_to_dead)
  {
      /* all of our writeable props go in the dead prop database */
      *defer_to_dead = 1;
  
      return NULL;
  }
  
  static const dav_hooks_liveprop dav_core_hooks_liveprop = {
      dav_core_insert_prop,
      dav_core_is_writable,
      dav_core_namespace_uris,
      dav_core_patch_validate,
      NULL,       /* patch_exec */
      NULL,       /* patch_commit */
      NULL,       /* patch_rollback */
  };
  
  int dav_core_find_liveprop(request_rec *r, const char *ns_uri,
                             const char *name,
                             const dav_hooks_liveprop **hooks)
  {
      return dav_do_find_liveprop(ns_uri, name, &dav_core_liveprop_group, hooks);
  }
  
  void dav_core_insert_all_liveprops(request_rec *r,
                                     const dav_resource *resource,
                                     int insvalue, ap_text_header *phdr)
  {
      (void) dav_core_insert_prop(resource, DAV_PROPID_resourcetype,
                                  insvalue, phdr);
      (void) dav_core_insert_prop(resource,
                                  DAV_PROPID_supported_live_property_set,
                                  insvalue, phdr);
      (void) dav_core_insert_prop(resource, DAV_PROPID_supported_method_set,
                                  insvalue, phdr);
      (void) dav_core_insert_prop(resource, DAV_PROPID_supported_report_set,
                                  insvalue, phdr);
  }
  
  void dav_core_register_uris(apr_pool_t *p)
  {
      /* register the namespace URIs */
      dav_register_liveprop_group(p, &dav_core_liveprop_group);
  }
  
  
  


gstein      00/11/23 05:03:47

  Modified:    src/os/win32 mod_isapi.c
               src/modules/standard mod_cern_meta.c mod_dir.c mod_include.c
                        mod_mime_magic.c mod_rewrite.c
               src/modules/test mod_autoindex.c
  Log:
  add the "next filter" parameter to the rest of the ap_sub_req_* calls.
  
  Revision  Changes    Path
  1.30      +3 -2      apache-2.0/src/os/win32/mod_isapi.c
  
  Index: mod_isapi.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/os/win32/mod_isapi.c,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -u -r1.29 -r1.30
  --- mod_isapi.c	2000/11/19 18:35:14	1.29
  +++ mod_isapi.c	2000/11/23 13:03:35	1.30
  @@ -816,7 +816,8 @@
           /* Map a URL to a filename */
           char *file = (char *)lpvBuffer;
           DWORD len;
  -        subreq = ap_sub_req_lookup_uri(apr_pstrndup(r->pool, file, *lpdwSize), r);
  +        subreq = ap_sub_req_lookup_uri(apr_pstrndup(r->pool, file, *lpdwSize),
  +                                       r, NULL);
   
           len = apr_cpystrn(file, subreq->filename, *lpdwSize) - file;
   
  @@ -996,7 +997,7 @@
           LPHSE_URL_MAPEX_INFO info = (LPHSE_URL_MAPEX_INFO) lpdwDataType;
           char* test_uri = apr_pstrndup(r->pool, (char *)lpvBuffer, *lpdwSize);
   
  -        subreq = ap_sub_req_lookup_uri(test_uri, r);
  +        subreq = ap_sub_req_lookup_uri(test_uri, r, NULL);
           info->cchMatchingURL = strlen(test_uri);        
           info->cchMatchingPath = apr_cpystrn(info->lpszPath, subreq->filename, 
                                               MAX_PATH) - info->lpszPath;
  
  
  
  1.24      +1 -1      apache-2.0/src/modules/standard/mod_cern_meta.c
  
  Index: mod_cern_meta.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_cern_meta.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -u -r1.23 -r1.24
  --- mod_cern_meta.c	2000/10/16 06:05:05	1.23
  +++ mod_cern_meta.c	2000/11/23 13:03:37	1.24
  @@ -359,7 +359,7 @@
        * A better solution might be a "safe open" feature of pfopen to avoid
        * pipes, symlinks, and crap like that.
        */
  -    rr = ap_sub_req_lookup_file(metafilename, r);
  +    rr = ap_sub_req_lookup_file(metafilename, r, NULL);
       if (rr->status != HTTP_OK) {
   	ap_destroy_sub_req(rr);
   	return DECLINED;
  
  
  
  1.22      +1 -1      apache-2.0/src/modules/standard/mod_dir.c
  
  Index: mod_dir.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_dir.c,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -u -r1.21 -r1.22
  --- mod_dir.c	2000/11/22 19:38:07	1.21
  +++ mod_dir.c	2000/11/23 13:03:39	1.22
  @@ -161,7 +161,7 @@
   
       for (; num_names; ++names_ptr, --num_names) {
           char *name_ptr = *names_ptr;
  -        request_rec *rr = ap_sub_req_lookup_uri(name_ptr, r, r->output_filters);
  +        request_rec *rr = ap_sub_req_lookup_uri(name_ptr, r, NULL);
   
           if (rr->status == HTTP_OK && rr->finfo.filetype == APR_REG) {
               char *new_uri = ap_escape_uri(r->pool, rr->uri);
  
  
  
  1.76      +5 -0      apache-2.0/src/modules/standard/mod_include.c
  
  Index: mod_include.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_include.c,v
  retrieving revision 1.75
  retrieving revision 1.76
  diff -u -u -r1.75 -r1.76
  --- mod_include.c	2000/11/22 19:49:20	1.75
  +++ mod_include.c	2000/11/23 13:03:39	1.76
  @@ -1359,6 +1359,9 @@
           }
           else {
               ap_getparents(tag_val);    /* get rid of any nasties */
  +
  +            /* note: it is okay to pass NULL for the "next filter" since
  +               we never attempt to "run" this sub request. */
               rr = ap_sub_req_lookup_file(tag_val, r, NULL);
   
               if (rr->status == HTTP_OK && rr->finfo.protection != 0) {
  @@ -1387,6 +1390,8 @@
           return ret;
       }
       else if (!strcmp(tag, "virtual")) {
  +        /* note: it is okay to pass NULL for the "next filter" since
  +           we never attempt to "run" this sub request. */
           rr = ap_sub_req_lookup_uri(tag_val, r, NULL);
   
           if (rr->status == HTTP_OK && rr->finfo.protection != 0) {
  
  
  
  1.32      +1 -1      apache-2.0/src/modules/standard/mod_mime_magic.c
  
  Index: mod_mime_magic.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_mime_magic.c,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -u -r1.31 -r1.32
  --- mod_mime_magic.c	2000/10/30 17:09:19	1.31
  +++ mod_mime_magic.c	2000/11/23 13:03:40	1.32
  @@ -2347,7 +2347,7 @@
       ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, 0, r,
   		MODNAME ": subrequest lookup for %s", sub_filename);
   #endif /* MIME_MAGIC_DEBUG */
  -    sub = ap_sub_req_lookup_file(sub_filename, r);
  +    sub = ap_sub_req_lookup_file(sub_filename, r, NULL);
   
       /* extract content type/encoding/language from sub-request */
       if (sub->content_type) {
  
  
  
  1.52      +3 -3      apache-2.0/src/modules/standard/mod_rewrite.c
  
  Index: mod_rewrite.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_rewrite.c,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -u -r1.51 -r1.52
  --- mod_rewrite.c	2000/11/13 18:11:12	1.51
  +++ mod_rewrite.c	2000/11/23 13:03:40	1.52
  @@ -2190,7 +2190,7 @@
           if (strlen(input) > 0 && subreq_ok(r)) {
   
               /* run a URI-based subrequest */
  -            rsub = ap_sub_req_lookup_uri(input, r);
  +            rsub = ap_sub_req_lookup_uri(input, r, NULL);
   
               /* URI exists for any result up to 3xx, redirects allowed */
               if (rsub->status < 400)
  @@ -2211,7 +2211,7 @@
               /* process a file-based subrequest:
                * this differs from -U in that no path translation is done.
                */
  -            rsub = ap_sub_req_lookup_file(input, r);
  +            rsub = ap_sub_req_lookup_file(input, r, NULL);
   
               /* file exists for any result up to 2xx, no redirects */
               if (rsub->status < 300 &&
  @@ -3595,7 +3595,7 @@
                           /*   ...and sub and main paths differ */ \
                           && strcmp(r->main->uri, r->uri) != 0))) { \
               /* process a file-based subrequest */ \
  -            rsub = subrecfunc(r->filename, r); \
  +            rsub = subrecfunc(r->filename, r, NULL); \
               /* now recursively lookup the variable in the sub_req */ \
               result = lookup_variable(rsub, var+5); \
               /* copy it up to our scope before we destroy sub_req's apr_pool_t */ \
  
  
  
  1.2       +3 -3      apache-2.0/src/modules/test/mod_autoindex.c
  
  Index: mod_autoindex.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/test/mod_autoindex.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -u -r1.1 -r1.2
  --- mod_autoindex.c	2000/11/09 21:32:49	1.1
  +++ mod_autoindex.c	2000/11/23 13:03:46	1.2
  @@ -974,7 +974,7 @@
        * pretend there's nothing there.
        */
       if ((header_fname != NULL)
  -	&& (rr = ap_sub_req_lookup_uri(header_fname, r))
  +	&& (rr = ap_sub_req_lookup_uri(header_fname, r, NULL))
   	&& (rr->status == HTTP_OK)
   	&& (rr->filename != NULL)
   	&& rr->finfo.filetype == APR_REG) {
  @@ -1057,7 +1057,7 @@
        * pretend there's nothing there.
        */
       if ((readme_fname != NULL)
  -	&& (rr = ap_sub_req_lookup_uri(readme_fname, r))
  +	&& (rr = ap_sub_req_lookup_uri(readme_fname, r, NULL))
   	&& (rr->status == HTTP_OK)
   	&& (rr->filename != NULL)
   	&& rr->finfo.filetype == APR_REG) {
  @@ -1184,7 +1184,7 @@
       p->version_sort = autoindex_opts & VERSION_SORT;
   
       if (autoindex_opts & FANCY_INDEXING) {
  -        request_rec *rr = ap_sub_req_lookup_file(name, r);
  +        request_rec *rr = ap_sub_req_lookup_file(name, r, NULL);
   
   	if (rr->finfo.protection != 0) {
   	    p->lm = rr->finfo.mtime;
  
  
  


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

Mime
View raw message