src/server/webdav/webdav.c

branch
webdav
changeset 233
c5985d2fc19a
parent 230
ca50e1ebdc4d
child 234
f30740c3aafb
equal deleted inserted replaced
232:499711b2a970 233:c5985d2fc19a
52 52
53 static WSNamespace dav_namespace; 53 static WSNamespace dav_namespace;
54 54
55 static WebdavProperty dav_resourcetype_empty; 55 static WebdavProperty dav_resourcetype_empty;
56 static WebdavProperty dav_resourcetype_collection; 56 static WebdavProperty dav_resourcetype_collection;
57 static WSXmlNode dav_resourcetype_collection_value; // TODO: change type to WSXmlData 57 static WSXmlData dav_resourcetype_collection_value;
58
59 #define WEBDAV_RESOURCE_TYPE_COLLECTION "<D:collection/>"
58 60
59 static void init_default_backend(void) { 61 static void init_default_backend(void) {
60 memset(&default_backend, 0, sizeof(WebdavBackend)); 62 memset(&default_backend, 0, sizeof(WebdavBackend));
61 default_backend.propfind_init = default_propfind_init; 63 default_backend.propfind_init = default_propfind_init;
62 default_backend.propfind_do = default_propfind_do; 64 default_backend.propfind_do = default_propfind_do;
99 dav_resourcetype_empty.namespace = &dav_namespace; 101 dav_resourcetype_empty.namespace = &dav_namespace;
100 dav_resourcetype_empty.name = "resourcetype"; 102 dav_resourcetype_empty.name = "resourcetype";
101 103
102 dav_resourcetype_collection.namespace = &dav_namespace; 104 dav_resourcetype_collection.namespace = &dav_namespace;
103 dav_resourcetype_collection.name = "resourcetype"; 105 dav_resourcetype_collection.name = "resourcetype";
104 dav_resourcetype_collection.value.node = &dav_resourcetype_collection_value; 106 dav_resourcetype_collection.value.data = &dav_resourcetype_collection_value;
105 dav_resourcetype_collection.vtype = WS_VALUE_XML_NODE; 107 dav_resourcetype_collection.vtype = WS_VALUE_XML_DATA;
106 dav_resourcetype_collection_value.content = (xmlChar*)"<D:collection/>"; 108 dav_resourcetype_collection_value.data = WEBDAV_RESOURCE_TYPE_COLLECTION;
107 dav_resourcetype_collection_value.type = XML_TEXT_NODE; 109 dav_resourcetype_collection_value.length = sizeof(WEBDAV_RESOURCE_TYPE_COLLECTION)-1;
108
109 110
110 return REQ_PROCEED; 111 return REQ_PROCEED;
111 } 112 }
112 113
113 114
260 ret = REQ_ABORTED; 261 ret = REQ_ABORTED;
261 } 262 }
262 } 263 }
263 } 264 }
264 265
265 // finish the propfind request
266 // this function should cleanup all resources, therefore we execute it
267 // even if a previous function failed
268 if(webdav_op_propfind_finish(op)) {
269 ret = REQ_ABORTED;
270 }
271
272 // if propfind was successful, send the result to the client 266 // if propfind was successful, send the result to the client
273 if(ret == REQ_PROCEED && multistatus_send(ms, sn->csd)) { 267 if(ret == REQ_PROCEED && multistatus_send(ms, sn->csd)) {
274 ret = REQ_ABORTED; 268 ret = REQ_ABORTED;
275 // TODO: log error 269 // TODO: log error
276 } else { 270 } else {
271 // TODO: error response
272 }
273
274 // finish the propfind request
275 // this function should cleanup all resources, therefore we execute it
276 // even if a previous function failed
277 if(webdav_op_propfind_finish(op)) {
277 // TODO: log error 278 // TODO: log error
278 // TODO: error response 279 ret = REQ_ABORTED;
279 } 280 }
280 281
281 return ret; 282 return ret;
282 } 283 }
283 284

mercurial