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 config.m4 mod_dav.c mod_dav.h props.c
Date Mon, 10 Jul 2000 07:49:51 GMT
gstein      00/07/10 00:49:49

  Modified:    src/modules/dav/fs mod_dav_fs.c repos.c repos.h
               src/modules/dav/main config.m4 mod_dav.c mod_dav.h props.c
  Log:
  complete the removal of the old dav_dyn crap. dav plugins are now
      implemented entirely through standard Apache modules, hooks, and some
      additional registration.
  
  Revision  Changes    Path
  1.5       +5 -0      apache-2.0/src/modules/dav/fs/mod_dav_fs.c
  
  Index: mod_dav_fs.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/dav/fs/mod_dav_fs.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- mod_dav_fs.c	2000/07/10 03:18:13	1.4
  +++ mod_dav_fs.c	2000/07/10 07:49:45	1.5
  @@ -125,6 +125,11 @@
       ap_hook_get_lock_hooks(dav_fs_get_lock_hooks, NULL, NULL, AP_HOOK_MIDDLE);
       ap_hook_get_propdb_hooks(dav_fs_get_propdb_hooks, NULL, NULL,
                                AP_HOOK_MIDDLE);
  +    ap_hook_gather_propsets(dav_fs_gather_propsets, NULL, NULL,
  +                            AP_HOOK_MIDDLE);
  +    ap_hook_find_liveprop(dav_fs_find_liveprop, NULL, NULL, AP_HOOK_MIDDLE);
  +    ap_hook_insert_all_liveprops(dav_fs_insert_all_liveprops, NULL, NULL,
  +                                 AP_HOOK_MIDDLE);
   
       dav_fs_register_uris(NULL /* ### pconf */);
   }
  
  
  
  1.14      +26 -26    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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- repos.c	2000/07/10 04:16:50	1.13
  +++ repos.c	2000/07/10 07:49:45	1.14
  @@ -2012,33 +2012,7 @@
       dav_fs_patch_rollback,
   };
   
  -/*
  -** Note: we do not provide an is_active function at this point. In the
  -** future, mod_dav may use that to determine if a particular provider is
  -** active/enabled, but it doesn't now.
  -*/
  -static const dav_dyn_provider dav_dyn_providers_fs[] =
  -{
  -    /* liveprop provider */
  -    {
  -	DAV_FS_PROVIDER_ID,
  -        DAV_DYN_TYPE_LIVEPROP,
  -        &dav_hooks_liveprop_fs
  -    },
  -
  -    /* must always be last */
  -    DAV_DYN_END_MARKER
  -};
  -
  -const dav_dyn_module dav_dyn_module_default =
  -{
  -    DAV_DYN_MAGIC,
  -    DAV_DYN_VERSION,
  -    "filesystem",
   
  -    dav_dyn_providers_fs
  -};
  -
   int dav_fs_hook_get_resource(request_rec *r, const char *root_dir,
                                const char *workspace)
   {
  @@ -2060,6 +2034,32 @@
   const dav_hooks_propdb *dav_fs_get_propdb_hooks(request_rec *r)
   {
       return &dav_hooks_db_dbm;
  +}
  +
  +void dav_fs_gather_propsets(ap_array_header_t *uris)
  +{
  +#ifndef WIN32
  +    *(const char **)ap_push_array(uris) =
  +        "<http://apache.org/dav/propset/fs/1>";
  +#endif
  +}
  +
  +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;
  +}
  +
  +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);
   }
   
   void dav_fs_register_uris(ap_pool_t *p)
  
  
  
  1.9       +6 -0      apache-2.0/src/modules/dav/fs/repos.h
  
  Index: repos.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/dav/fs/repos.h,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- repos.h	2000/07/10 03:18:13	1.8
  +++ repos.h	2000/07/10 07:49:45	1.9
  @@ -100,6 +100,12 @@
   const dav_hooks_locks *dav_fs_get_lock_hooks(request_rec *r);
   const dav_hooks_propdb *dav_fs_get_propdb_hooks(request_rec *r);
   
  +void dav_fs_gather_propsets(ap_array_header_t *uris);
  +int dav_fs_find_liveprop(request_rec *r, const char *ns_uri, const char *name,
  +                         const dav_hooks_liveprop **hooks);
  +void dav_fs_insert_all_liveprops(request_rec *r, const dav_resource *resource,
  +                                 int insvalue, ap_text_header *phdr);
  +
   void dav_fs_register_uris(ap_pool_t *p);
   
   #endif /* _DAV_FS_REPOS_H_ */
  
  
  
  1.7       +0 -8      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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- config.m4	2000/07/10 04:16:50	1.6
  +++ config.m4	2000/07/10 07:49:47	1.7
  @@ -13,13 +13,5 @@
     INCLUDES="$INCLUDES -I\$(top_srcdir)/$modpath_current"
   fi
   
  -dnl ### hack. we reference a symbol from the dav_fs "library", but that lib
  -dnl ### appears on the link line first. nothing refers to the variable, so
  -dnl ### it doesn't get sucked in. we will add the lib one more time *after*
  -dnl ### our location on the link line, so we pick the thing up.
  -if test "$enable_dav" = "yes"; then
  -  BUILTIN_LIBS="$BUILTIN_LIBS $modpath_current/../fs/libapachemod_dav_fs.la"
  -fi
  -
   
   APACHE_MODPATH_FINISH
  
  
  
  1.12      +19 -57    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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- mod_dav.c	2000/07/10 04:16:50	1.11
  +++ mod_dav.c	2000/07/10 07:49:47	1.12
  @@ -110,9 +110,7 @@
       long limit_xml_body;
   
       ap_table_t *d_params;	/* per-directory DAV config parameters */
  -    struct dav_dyn_mod_ctx *dmc;
   
  -    dav_dyn_hooks *liveprop;
   } dav_dir_conf;
   
   /* per-server configuration */
  @@ -132,27 +130,6 @@
   /* forward-declare for use in configuration lookup */
   extern module MODULE_VAR_EXPORT dav_module;
   
  -/* copy a module's providers into our per-directory configuration state */
  -static void dav_copy_providers(ap_pool_t *p, const char *name, dav_dir_conf *conf)
  -{
  -    extern const dav_dyn_module dav_dyn_module_default;
  -
  -    const dav_dyn_module *mod;
  -    const dav_dyn_provider *provider;
  -    dav_dyn_hooks *ddh;
  -
  -    /* ### just hard-code this stuff for now */
  -
  -    /* mod = dav_find_module(name); */
  -    mod = &dav_dyn_module_default;
  -
  -    provider = mod->providers;
  -
  -    ddh = ap_pcalloc(p, sizeof(*ddh));
  -    ddh->hooks = provider->hooks;
  -    conf->liveprop = ddh;
  -}
  -
   static void dav_init_handler(ap_pool_t *p, ap_pool_t *plog, ap_pool_t *ptemp,
                                server_rec *s)
   {
  @@ -200,14 +177,6 @@
       conf->d_params = ap_make_table(p, 1);
       conf->limit_xml_body = DAV_LIMIT_UNSET;
   
  -    /* DBG1("dav_create_dir_config: %08lx", (long)conf); */
  -
  -    /*
  -    ** Locate the appropriate module (NULL == default) and copy the module's
  -    ** providers' hooks into our configuration state.
  -    */
  -    dav_copy_providers(p, NULL, conf);
  -
       return conf;
   }
   
  @@ -235,11 +204,6 @@
       ap_overlap_tables(newconf->d_params, child->d_params,
   		      AP_OVERLAP_TABLES_SET);
   
  -    if (child->liveprop != NULL)
  -        newconf->liveprop = child->liveprop;
  -    else
  -        newconf->liveprop = parent->liveprop;
  -
       return newconf;
   }
   
  @@ -318,14 +282,6 @@
       return hooks;
   }
   
  -const dav_dyn_hooks *dav_get_liveprop_hooks(request_rec *r)
  -{
  -    dav_dir_conf *conf;
  -
  -    conf = ap_get_module_config(r->per_dir_config, &dav_module);
  -    return conf->liveprop;
  -}
  -
   /*
    * Command handler for the DAV directive, which is FLAG.
    */
  @@ -1335,8 +1291,8 @@
       const char *dav_level;
       const char *vsn_level;
       int result;
  -    const dav_dir_conf *conf;
  -    const dav_dyn_hooks *lp;
  +    ap_array_header_t *uri_ary;
  +    const char *uris;
   
       /* per HTTP/1.1 S9.2, we can discard this body */
       if ((result = ap_discard_request_body(r)) != OK) {
  @@ -1361,18 +1317,13 @@
       if (vsn_hooks != NULL) {
           vsn_level = (*vsn_hooks->get_vsn_header)();
       }
  -
  -    /*
  -    ** Iterate through the live property providers; add their URIs to
  -    ** the dav_level string.
  -    */
  -    conf = (dav_dir_conf *) ap_get_module_config(r->per_dir_config,
  -						 &dav_module);
  -    for (lp = conf->liveprop; lp != NULL; lp = lp->next) {
  -        const char *uri = DAV_AS_HOOKS_LIVEPROP(lp)->propset_uri;
   
  -        if (uri != NULL)
  -            dav_level = ap_pstrcat(r->pool, dav_level, ",<", uri, ">", NULL);
  +    /* gather property set URIs from all the liveprop providers */
  +    uri_ary = ap_make_array(r->pool, 5, sizeof(const char *));
  +    ap_run_gather_propsets(uri_ary);
  +    uris = ap_array_pstrcat(r->pool, uri_ary, ',');
  +    if (*uris) {
  +        dav_level = ap_pstrcat(r->pool, dav_level, ",", uris, NULL);
       }
   
       /* this tells MSFT products to skip looking for FrontPage extensions */
  @@ -3220,6 +3171,7 @@
       AP_HOOK_LINK(get_lock_hooks)
       AP_HOOK_LINK(get_propdb_hooks)
       AP_HOOK_LINK(get_vsn_hooks)
  +    AP_HOOK_LINK(gather_propsets)
       AP_HOOK_LINK(find_liveprop)
       AP_HOOK_LINK(insert_all_liveprops)
       )
  @@ -3233,3 +3185,13 @@
                               (request_rec *r), (r), NULL);
   AP_IMPLEMENT_HOOK_RUN_FIRST(const dav_hooks_vsn *, get_vsn_hooks,
                               (request_rec *r), (r), NULL);
  +AP_IMPLEMENT_HOOK_VOID(gather_propsets, (ap_array_header_t *uris), (uris))
  +AP_IMPLEMENT_HOOK_RUN_FIRST(int, find_liveprop,
  +                            (request_rec *r,
  +                             const char *ns_uri, const char *name,
  +                             const dav_hooks_liveprop **hooks),
  +                            (r, ns_uri, name, hooks), 0);
  +AP_IMPLEMENT_HOOK_VOID(insert_all_liveprops,
  +                       (request_rec *r, const dav_resource *resource,
  +                        int insvalue, ap_text_header *phdr),
  +                       (r, resource, insvalue, phdr));
  
  
  
  1.13      +1 -110    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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- mod_dav.h	2000/07/10 04:16:51	1.12
  +++ mod_dav.h	2000/07/10 07:49:48	1.13
  @@ -393,6 +393,7 @@
   AP_DECLARE_HOOK(const dav_hooks_propdb *, get_propdb_hooks, (request_rec *r))
   AP_DECLARE_HOOK(const dav_hooks_vsn *, get_vsn_hooks, (request_rec *r))
   
  +AP_DECLARE_HOOK(void, gather_propsets, (ap_array_header_t *uris))
   AP_DECLARE_HOOK(int, find_liveprop, (request_rec *r,
                                        const char *ns_uri, const char *name,
                                        const dav_hooks_liveprop **hooks))
  @@ -416,120 +417,10 @@
   void dav_add_all_liveprop_xmlns(ap_pool_t *p, ap_text_header *phdr);
   
   
  -/* --------------------------------------------------------------------
  -**
  -** ====> DEPRECATED <====
  -**
  -** DYNAMIC EXTENSIONS
  -*/
  -
  -/* ### docco goes here... */
  -
  -
  -/*
  -** This structure is used to specify a set of hooks and its associated
  -** context, on a per-directory/location basis.
  -**
  -** Note: the context is assembled from various sources. dav_dyn_hooks
  -** structures will typically have the same pointer values within the
  -** context (e.g. ctx.m_context is shared across all providers in a module).
  -*/
  -typedef struct dav_dyn_hooks
  -{
  -    const void *hooks;		/* the type-specific hooks */
  -
  -    struct dav_dyn_hooks *next;	/* next set of hooks, if applicable */
  -
  -} dav_dyn_hooks;
  -
  -/*
  -** These enumerated values define the different types of functionality that
  -** a provider can implement.
  -*/
  -enum
  -{
  -    DAV_DYN_TYPE_SENTINEL,
  -
  -    DAV_DYN_TYPE_PROPDB,	/* property database (1 per dir) */
  -    DAV_DYN_TYPE_LOCKS,		/* lock handling (1 per dir) */
  -    DAV_DYN_TYPE_QUERY_GRAMMAR,	/* DASL search grammar (N per dir) */
  -    DAV_DYN_TYPE_ACL,		/* ACL handling (1 per dir) */
  -    DAV_DYN_TYPE_VSN,		/* versioning (1 per dir) */
  -    DAV_DYN_TYPE_LIVEPROP,	/* live property handler (N per dir) */
  -
  -    DAV_DYN_TYPE_MAX
  -};
  -
  -/*
  -** This structure defines a provider for a particular type of functionality.
  -**
  -** The ID is private to a provider and can be used to differentiate between
  -** different subclasses of functionality which are implemented using the
  -** same set of hooks. For example, a hook function could perform two entirely
  -** different operations based on the ID which is passed.
  -**
  -** is_active() is used by the system to determine whether a particular
  -** provider is "active" for the given context. It is possible that a provider
  -** is configured for a directory, but has not been enabled -- the is_active()
  -** function is used to determine that information.
  -**
  -** ### is_active is not used right now
  -**
  -** Note: dav_dyn_provider structures are always treated as "const" by mod_dav.
  -*/
  -typedef struct dav_dyn_provider
  -{
  -    int id;			/* provider ID */
  -
  -    int type;			/* provider's functionality type */
  -    const void *hooks;		/* pointer to type-specific hooks */
  -
  -} dav_dyn_provider;
  -
  -#define DAV_DYN_END_MARKER	{ 0, DAV_DYN_TYPE_SENTINEL, NULL }
  -
  -/*
  -** This structure defines a module (a set of providers).
  -**
  -** The friendly name should be a single word. It is used with the "DAV"
  -** directive to specify the module to use for a particular directory/location.
  -**
  -** The module_open/close functions are used to initialize per-module "global"
  -** data. The functions are expected to update ctx->m_context.
  -**
  -** ### module_open/close are not used at the moment
  -** ### dir_* are not well-defined, nor are they used
  -**
  -** Note: The DAV_DYN_VERSION specifies the version of the dav_dyn_module
  -**       structure itself. It will be updated if changes in the structure
  -**       are made. There are no provisions for forward or backward
  -**       compatible changes.
  -**
  -** Note: dav_dyn_module structures are always treated as "const" by mod_dav.
  -*/
  -typedef struct
  -{
  -    int magic;
  -#define DAV_DYN_MAGIC		0x44415621	/* "DAV!" */
  -
  -    int version;
  -#define DAV_DYN_VERSION		1		/* must match exactly */
  -
  -    const char *name;				/* friendly name */
  -
  -    const dav_dyn_provider *providers;		/* providers in this module */
  -
  -} dav_dyn_module;
  -
   /* ### deprecated */
   #define DAV_GET_HOOKS_PROPDB(r)         dav_get_propdb_hooks(r)
   #define DAV_GET_HOOKS_LOCKS(r)          dav_get_lock_hooks(r)
   #define DAV_GET_HOOKS_VSN(r)            dav_get_vsn_hooks(r)
  -
  -/* ### temporary; this semantic won't apply in the new scheme */
  -const dav_dyn_hooks *dav_get_liveprop_hooks(request_rec *r);
  -#define DAV_AS_HOOKS_LIVEPROP(ph)	((const dav_hooks_liveprop *)((ph)->hooks))
  -#define DAV_GET_HOOKS_LIVEPROP(r)       DAV_AS_HOOKS_LIVEPROP(dav_get_liveprop_hooks(r))
   
   
   /* --------------------------------------------------------------------
  
  
  
  1.11      +20 -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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- props.c	2000/07/10 06:56:29	1.10
  +++ props.c	2000/07/10 07:49:48	1.11
  @@ -268,7 +268,6 @@
       const dav_hooks_db *db_hooks;
       const dav_hooks_vsn *vsn_hooks;
   
  -    const dav_dyn_hooks *liveprop;	/* head of list */
   };
   
   /* ### move these into a "core" liveprop provider? */
  @@ -326,8 +325,8 @@
   {
       int propid;
       const char *ns_uri;
  -    const dav_dyn_hooks *ddh;
       dav_elem_private *priv = elem->private;
  +    const dav_hooks_liveprop *hooks;
   
       if (elem->ns == AP_XML_NS_DAV_ID) {
   	const char * const *p = dav_core_props;
  @@ -346,25 +345,24 @@
   	return;
       }
   
  +    /* get the URI for the element's namespace id */
       ns_uri = AP_XML_GET_URI_ITEM(propdb->ns_xlate, elem->ns);
   
  -    for (ddh = propdb->liveprop; ddh != NULL; ddh = ddh->next) {
  -	propid = (*DAV_AS_HOOKS_LIVEPROP(ddh)->find_prop)(ns_uri, elem->name);
  -	if (propid != 0) {
  -	    priv->propid = propid;
  -	    priv->provider = DAV_AS_HOOKS_LIVEPROP(ddh);
  -	    return;
  -	}
  +    /* is there a liveprop provider for this property? */
  +    propid = ap_run_find_liveprop(propdb->r, ns_uri, elem->name, &hooks);
  +    if (propid != 0) {
  +        priv->propid = propid;
  +        priv->provider = hooks;
  +        return;
       }
   
       priv->propid = DAV_PROPID_CORE_UNKNOWN;
   }
   
   /* is the live property read/write? */
  -static int dav_rw_liveprop(dav_propdb *propdb, int propid)
  +static int dav_rw_liveprop(dav_propdb *propdb, dav_elem_private *priv)
   {
  -    dav_prop_rw rw;
  -    const dav_dyn_hooks *ddh;
  +    int propid = priv->propid;
   
       /* these are defined as read-only */
       if (propid == DAV_PROPID_CORE_lockdiscovery
  @@ -389,13 +387,14 @@
       /*
       ** Check the liveprop providers
       */
  -    for (ddh = propdb->liveprop; ddh != NULL; ddh = ddh->next) {
  -	rw = (*DAV_AS_HOOKS_LIVEPROP(ddh)->is_writeable)(propdb->resource,
  -							 propid);
  -	if (rw == DAV_PROP_RW_YES)
  -	    return 1;
  -	if (rw == DAV_PROP_RW_NO)
  -	    return 0;
  +    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;
       }
   
       /*
  @@ -971,9 +970,6 @@
       propdb->db_hooks = DAV_GET_HOOKS_PROPDB(r);
       propdb->vsn_hooks = DAV_GET_HOOKS_VSN(r);
   
  -    /* ### this will need to change */
  -    propdb->liveprop = dav_get_liveprop_hooks(r);
  -
       propdb->lockdb = lockdb;
   
       if (!ro) {
  @@ -1030,7 +1026,6 @@
       int found_contenttype = 0;
       int found_contentlang = 0;
       int unused_inserted;
  -    const dav_dyn_hooks *ddh;
   
       /* generate all the namespaces that are in the propdb */
       dav_get_propdb_xmlns(propdb, &hdr_ns);
  @@ -1124,10 +1119,7 @@
       dav_add_all_liveprop_xmlns(propdb->p, &hdr_ns);
       
       /* ask the liveprop providers to insert their properties */
  -    for (ddh = propdb->liveprop; ddh != NULL; ddh = ddh->next) {
  -	(*DAV_AS_HOOKS_LIVEPROP(ddh)->insert_all)(propdb->resource, getvals,
  -						  &hdr);
  -    }
  +    ap_run_insert_all_liveprops(propdb->r, propdb->resource, getvals, &hdr);
   
       /* insert the standard properties */
       /* ### should be handling the return errors here */
  @@ -1374,7 +1366,7 @@
   	ctx->is_liveprop = priv->provider != NULL;
       }
   
  -    if (!dav_rw_liveprop(propdb, priv->propid)) {
  +    if (!dav_rw_liveprop(propdb, priv)) {
   	ctx->err = dav_new_error(propdb->p, HTTP_CONFLICT,
   				 DAV_ERR_PROP_READONLY,
   				 "Property is read-only.");
  
  
  

Mime
View raw message