src/server/webdav/webdav.c

branch
webdav
changeset 222
5f05e56cb8e2
parent 221
ff5826fc6a6c
child 227
3c23855f7b46
equal deleted inserted replaced
221:ff5826fc6a6c 222:5f05e56cb8e2
212 // WebdavResponse is the public interface used by Backends 212 // WebdavResponse is the public interface used by Backends
213 // for adding resources to the response 213 // for adding resources to the response
214 WebdavResponse *response = (WebdavResponse*)ms; 214 WebdavResponse *response = (WebdavResponse*)ms;
215 215
216 WebdavOperation *op = webdav_operation_create( 216 WebdavOperation *op = webdav_operation_create(
217 sn->pool, 217 sn,
218 rq,
218 dav, 219 dav,
219 requestObjects, 220 requestObjects,
220 response); 221 response);
221 222
222 // some Backends can list all children by themselves, but some 223 // some Backends can list all children by themselves, but some
264 // finish the propfind request 265 // finish the propfind request
265 // this function should cleanup all resources, therefore we execute it 266 // this function should cleanup all resources, therefore we execute it
266 // even if a previous function failed 267 // even if a previous function failed
267 if(webdav_op_propfind_finish(op)) { 268 if(webdav_op_propfind_finish(op)) {
268 ret = REQ_ABORTED; 269 ret = REQ_ABORTED;
270 }
271
272 // if propfind was successful, send the result to the client
273 if(ret == REQ_PROCEED && multistatus_send(ms, sn->csd)) {
274 ret = REQ_ABORTED;
275 // TODO: log error
276 } else {
277 // TODO: log error
278 // TODO: error response
269 } 279 }
270 280
271 return ret; 281 return ret;
272 } 282 }
273 283
558 node->content = (xmlChar*)value; 568 node->content = (xmlChar*)value;
559 node->type = XML_TEXT_NODE; 569 node->type = XML_TEXT_NODE;
560 570
561 p->value.node = node; 571 p->value.node = node;
562 p->vtype = WS_VALUE_XML_NODE; 572 p->vtype = WS_VALUE_XML_NODE;
573 return 0;
574 }
575
576 int webdav_property_add_nsdef(
577 WebdavProperty *property,
578 pool_handle_t *pool,
579 const char *prefix,
580 const char *nsuri)
581 {
582 // because we're using a memory pool, we don't free in case stuff in
583 // case of an error (OOM) - stuff will be freed by destroyinig the pool
584
585 WebdavNSList *new_def = pool_malloc(pool, sizeof(WebdavNSList));
586 if(!new_def) {
587 return 1;
588 }
589 WSNamespace *new_ns = pool_malloc(pool, sizeof(WSNamespace));
590 if(!new_ns) {
591 return 1;
592 }
593 ZERO(new_ns, sizeof(WSNamespace));
594
595 new_ns->prefix = (xmlChar*)pool_strdup(pool, prefix);
596 new_ns->href = (xmlChar*)pool_strdup(pool, nsuri);
597 if(!new_ns->prefix || !new_ns->href) {
598 return 1;
599 }
600
601 new_def->namespace = new_ns;
602 new_def->prev = NULL;
603 new_def->next = NULL;
604
605 if(property->nsdef) {
606 property->nsdef->prev = new_def;
607 new_def->next = property->nsdef;
608 }
609 property->nsdef = new_def;
610
563 return 0; 611 return 0;
564 } 612 }
565 613
566 WebdavVFSProperties webdav_vfs_properties( 614 WebdavVFSProperties webdav_vfs_properties(
567 WebdavPropfindRequest *rq, 615 WebdavPropfindRequest *rq,

mercurial