summaryrefslogtreecommitdiffstats
path: root/modules/dav/main
diff options
context:
space:
mode:
authorGraham Leggett <minfrin@apache.org>2020-07-15 15:56:55 +0200
committerGraham Leggett <minfrin@apache.org>2020-07-15 15:56:55 +0200
commitc52f3e8c6c376387a9002a777b98e2ddba64564a (patch)
treebb2013358d260b1c822dbe658b75cc9721df9c59 /modules/dav/main
parentmod_dav: Add utility functions dav_validate_root_ns(), (diff)
downloadapache2-c52f3e8c6c376387a9002a777b98e2ddba64564a.tar.xz
apache2-c52f3e8c6c376387a9002a777b98e2ddba64564a.zip
mod_dav: Some DAV extensions, like CalDAV, specify both document
elements and property elements that need to be taken into account when generating a property. The document element and property element are made available in the dav_liveprop_elem structure under the DAV_PROP_ELEMENT key in the resource pool. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1879889 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/dav/main')
-rw-r--r--modules/dav/main/mod_dav.h22
-rw-r--r--modules/dav/main/props.c10
2 files changed, 32 insertions, 0 deletions
diff --git a/modules/dav/main/mod_dav.h b/modules/dav/main/mod_dav.h
index 05364f3e9d..b6a6a5f8e4 100644
--- a/modules/dav/main/mod_dav.h
+++ b/modules/dav/main/mod_dav.h
@@ -913,6 +913,14 @@ struct dav_hooks_liveprop
** property, and does not want it handled as a dead property, it should
** return DAV_PROP_INSERT_NOTSUPP.
**
+ ** Some DAV extensions, like CalDAV, specify both document elements
+ ** and property elements that need to be taken into account when
+ ** generating a property. The document element and property element
+ ** are made available in the dav_liveprop_elem structure under the
+ ** DAV_PROP_ELEMENT key in the resource pool, accessible as follows:
+ **
+ ** apr_pool_userdata_get(&elem, DAV_PROP_ELEMENT, resource->pool);
+ **
** Returns one of DAV_PROP_INSERT_* based on what happened.
**
** ### we may need more context... ie. the lock database
@@ -1061,6 +1069,20 @@ DAV_DECLARE(void) dav_add_all_liveprop_xmlns(apr_pool_t *p,
apr_text_header *phdr);
/*
+ ** When calling insert_prop(), the request element is associated with
+ ** the pool userdata attached to the resource. Access as follows:
+ **
+ ** apr_pool_userdata_get(&elem, DAV_PROP_ELEMENT, resource->pool);
+ **
+ */
+#define DAV_PROP_ELEMENT "mod_dav-element"
+
+typedef struct {
+ const apr_xml_doc *doc;
+ const apr_xml_elem *elem;
+} dav_liveprop_elem;
+
+/*
** 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.
*/
diff --git a/modules/dav/main/props.c b/modules/dav/main/props.c
index 8b0e1212d8..37c5666ac1 100644
--- a/modules/dav/main/props.c
+++ b/modules/dav/main/props.c
@@ -795,10 +795,18 @@ DAV_DECLARE(dav_get_props_result) dav_get_props(dav_propdb *propdb,
apr_text_header hdr_ns = { 0 };
int have_good = 0;
dav_get_props_result result = { 0 };
+ dav_liveprop_elem *element;
char *marks_liveprop;
dav_xmlns_info *xi;
int xi_filled = 0;
+ /* we lose both the document and the element when calling (insert_prop),
+ * make these available in the pool.
+ */
+ element = apr_pcalloc(propdb->resource->pool, sizeof(dav_liveprop_elem));
+ element->doc = doc;
+ apr_pool_userdata_setn(element, DAV_PROP_ELEMENT, NULL, propdb->resource->pool);
+
/* ### NOTE: we should pass in TWO buffers -- one for keys, one for
the marks */
@@ -822,6 +830,8 @@ DAV_DECLARE(dav_get_props_result) dav_get_props(dav_propdb *propdb,
dav_prop_insert inserted;
dav_prop_name name;
+ element->elem = elem;
+
/*
** First try live property providers; if they don't handle
** the property, then try looking it up in the propdb.