From f8f50c98ecda1bca35a4e4085494394f3ef452a0 Mon Sep 17 00:00:00 2001 From: Greg Stein Date: Mon, 27 Nov 2000 12:54:28 +0000 Subject: [PATCH] *) make find_liveprop() hook take a dav_resource rather than "r" *) repos.c: liveprop hooks shouldn't respond if the resource is not an FS resource. *) std_liveprop.c: use empty-elem form if value=="". return NOTDEF for the properties that we aren't ready to insert yet git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87087 13f79535-47bb-0310-9956-ffa450edef68 --- modules/dav/fs/repos.c | 10 +++++++++- modules/dav/fs/repos.h | 3 ++- modules/dav/main/mod_dav.c | 6 +++--- modules/dav/main/mod_dav.h | 7 ++++--- modules/dav/main/props.c | 3 ++- modules/dav/main/std_liveprop.c | 8 +++++--- 6 files changed, 25 insertions(+), 12 deletions(-) diff --git a/modules/dav/fs/repos.c b/modules/dav/fs/repos.c index 06878921f1..6030ca5b44 100644 --- a/modules/dav/fs/repos.c +++ b/modules/dav/fs/repos.c @@ -1998,15 +1998,23 @@ void dav_fs_gather_propsets(apr_array_header_t *uris) #endif } -int dav_fs_find_liveprop(request_rec *r, const char *ns_uri, const char *name, +int dav_fs_find_liveprop(const dav_resource *resource, + const char *ns_uri, const char *name, const dav_hooks_liveprop **hooks) { + /* don't try to find any liveprops if this isn't "our" resource */ + if (resource->hooks != &dav_hooks_repository_fs) + return 0; 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) { + /* don't insert any liveprops if this isn't "our" resource */ + if (resource->hooks != &dav_hooks_repository_fs) + return; + if (!resource->exists) { /* a lock-null resource */ /* diff --git a/modules/dav/fs/repos.h b/modules/dav/fs/repos.h index 43ab9422fe..cfdd9dbc53 100644 --- a/modules/dav/fs/repos.h +++ b/modules/dav/fs/repos.h @@ -99,7 +99,8 @@ 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(apr_array_header_t *uris); -int dav_fs_find_liveprop(request_rec *r, const char *ns_uri, const char *name, +int dav_fs_find_liveprop(const dav_resource *resource, + 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); diff --git a/modules/dav/main/mod_dav.c b/modules/dav/main/mod_dav.c index cfc8bcc979..360b66f4f9 100644 --- a/modules/dav/main/mod_dav.c +++ b/modules/dav/main/mod_dav.c @@ -4071,10 +4071,10 @@ AP_IMPLEMENT_EXTERNAL_HOOK_VOID(DAV, gather_propsets, (apr_array_header_t *uris), (uris)) AP_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(DAV, int, find_liveprop, - (request_rec *r, const char *ns_uri, - const char *name, + (const dav_resource *resource, + const char *ns_uri, const char *name, const dav_hooks_liveprop **hooks), - (r, ns_uri, name, hooks), 0); + (resource, ns_uri, name, hooks), 0); AP_IMPLEMENT_EXTERNAL_HOOK_VOID(DAV, insert_all_liveprops, (request_rec *r, const dav_resource *resource, int insvalue, ap_text_header *phdr), diff --git a/modules/dav/main/mod_dav.h b/modules/dav/main/mod_dav.h index df9cda48fa..592778db3f 100644 --- a/modules/dav/main/mod_dav.h +++ b/modules/dav/main/mod_dav.h @@ -561,7 +561,8 @@ AP_DECLARE_EXTERNAL_HOOK(DAV, void, gather_propsets, ** Return 0 if the property is not defined by the hook implementor. */ AP_DECLARE_EXTERNAL_HOOK(DAV, int, find_liveprop, - (request_rec *r, const char *ns_uri, const char *name, + (const dav_resource *resource, + const char *ns_uri, const char *name, const dav_hooks_liveprop **hooks)) /* @@ -834,8 +835,8 @@ 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, +int dav_core_find_liveprop(const dav_resource *resource, + 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, diff --git a/modules/dav/main/props.c b/modules/dav/main/props.c index 21c020adae..1b0627b10f 100644 --- a/modules/dav/main/props.c +++ b/modules/dav/main/props.c @@ -354,7 +354,8 @@ static void dav_find_liveprop(dav_propdb *propdb, ap_xml_elem *elem) ns_uri = AP_XML_GET_URI_ITEM(propdb->ns_xlate, elem->ns); /* is there a liveprop provider for this property? */ - propid = ap_run_find_liveprop(propdb->r, ns_uri, elem->name, &hooks); + propid = ap_run_find_liveprop(propdb->resource, ns_uri, elem->name, + &hooks); if (propid != 0) { priv->propid = propid; priv->provider = hooks; diff --git a/modules/dav/main/std_liveprop.c b/modules/dav/main/std_liveprop.c index 0f7d26e0a6..8ae1782ebd 100644 --- a/modules/dav/main/std_liveprop.c +++ b/modules/dav/main/std_liveprop.c @@ -147,10 +147,12 @@ static dav_prop_insert dav_core_insert_prop(const dav_resource *resource, case DAV_PROPID_supported_live_property_set: /* ### insert all live property names ### */ + return DAV_PROP_INSERT_NOTDEF; break; case DAV_PROPID_supported_method_set: /* ### leverage code from dav_method_options ### */ + return DAV_PROP_INSERT_NOTDEF; break; case DAV_PROPID_supported_report_set: @@ -216,7 +218,7 @@ static dav_prop_insert dav_core_insert_prop(const dav_resource *resource, /* assert: info != NULL && info->name != NULL */ - if (insvalue) { + if (insvalue && *value != '\0') { s = apr_psprintf(p, "%s" DEBUG_CR, global_ns, info->name, value, global_ns, info->name); which = DAV_PROP_INSERT_VALUE; @@ -260,8 +262,8 @@ static const dav_hooks_liveprop dav_core_hooks_liveprop = { NULL, /* patch_rollback */ }; -int dav_core_find_liveprop(request_rec *r, const char *ns_uri, - const char *name, +int dav_core_find_liveprop(const dav_resource *resource, + 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); -- 2.50.1