src/server/webdav/webdav.c

branch
webdav
changeset 233
c5985d2fc19a
parent 230
ca50e1ebdc4d
child 234
f30740c3aafb
--- a/src/server/webdav/webdav.c	Sat Jan 18 13:48:59 2020 +0100
+++ b/src/server/webdav/webdav.c	Sat Jan 18 16:31:52 2020 +0100
@@ -54,7 +54,9 @@
 
 static WebdavProperty dav_resourcetype_empty;
 static WebdavProperty dav_resourcetype_collection;
-static WSXmlNode dav_resourcetype_collection_value; // TODO: change type to WSXmlData
+static WSXmlData dav_resourcetype_collection_value;
+
+#define WEBDAV_RESOURCE_TYPE_COLLECTION "<D:collection/>"
 
 static void init_default_backend(void) {
     memset(&default_backend, 0, sizeof(WebdavBackend));
@@ -101,11 +103,10 @@
     
     dav_resourcetype_collection.namespace = &dav_namespace;
     dav_resourcetype_collection.name = "resourcetype";
-    dav_resourcetype_collection.value.node = &dav_resourcetype_collection_value;
-    dav_resourcetype_collection.vtype = WS_VALUE_XML_NODE;
-    dav_resourcetype_collection_value.content = (xmlChar*)"<D:collection/>";
-    dav_resourcetype_collection_value.type = XML_TEXT_NODE;
-    
+    dav_resourcetype_collection.value.data = &dav_resourcetype_collection_value;
+    dav_resourcetype_collection.vtype = WS_VALUE_XML_DATA;
+    dav_resourcetype_collection_value.data = WEBDAV_RESOURCE_TYPE_COLLECTION;
+    dav_resourcetype_collection_value.length = sizeof(WEBDAV_RESOURCE_TYPE_COLLECTION)-1;
     
     return REQ_PROCEED;
 }
@@ -262,20 +263,20 @@
         }
     }
     
-    // finish the propfind request
-    // this function should cleanup all resources, therefore we execute it
-    // even if a previous function failed
-    if(webdav_op_propfind_finish(op)) {
-        ret = REQ_ABORTED;
-    }
-    
     // if propfind was successful, send the result to the client
     if(ret == REQ_PROCEED && multistatus_send(ms, sn->csd)) {
         ret = REQ_ABORTED;
         // TODO: log error
     } else {
+        // TODO: error response
+    }
+    
+    // finish the propfind request
+    // this function should cleanup all resources, therefore we execute it
+    // even if a previous function failed
+    if(webdav_op_propfind_finish(op)) {
         // TODO: log error
-        // TODO: error response
+        ret = REQ_ABORTED;
     }
     
     return ret;

mercurial