src/server/webdav/webdav.c

branch
webdav
changeset 237
ee1680ef1ef2
parent 236
e81d3e517b57
child 239
d5031c30022c
equal deleted inserted replaced
236:e81d3e517b57 237:ee1680ef1ef2
226 226
227 WebdavOperation *op = webdav_operation_create( 227 WebdavOperation *op = webdav_operation_create(
228 sn, 228 sn,
229 rq, 229 rq,
230 dav, 230 dav,
231 propfind->properties,
231 requestObjects, 232 requestObjects,
232 response); 233 response);
233 234
234 // some Backends can list all children by themselves, but some 235 // some Backends can list all children by themselves, but some
235 // require the VFS for this 236 // require the VFS for this
412 if(!data) { 413 if(!data) {
413 return 1; 414 return 1;
414 } 415 }
415 rq->userdata = data; 416 rq->userdata = data;
416 417
417 data->vfsproperties = webdav_vfs_properties(rq, TRUE, 0); 418 data->vfsproperties = webdav_vfs_properties(outplist, TRUE, 0);
418 419
419 return 0; 420 return 0;
420 } 421 }
421 422
422 int default_propfind_do( 423 int default_propfind_do(
627 p->vtype = WS_VALUE_XML_NODE; 628 p->vtype = WS_VALUE_XML_NODE;
628 return 0; 629 return 0;
629 } 630 }
630 631
631 WebdavVFSProperties webdav_vfs_properties( 632 WebdavVFSProperties webdav_vfs_properties(
632 WebdavPropfindRequest *rq, 633 WebdavPList **plistInOut,
633 WSBool removefromlist, 634 WSBool removefromlist,
634 uint32_t flags) 635 uint32_t flags)
635 { 636 {
636 WebdavVFSProperties ret; 637 WebdavVFSProperties ret;
637 ZERO(&ret, sizeof(WebdavVFSProperties)); 638 ZERO(&ret, sizeof(WebdavVFSProperties));
638 639
639 WSBool etag = 1; 640 WSBool etag = 1;
640 WSBool creationdate = 1; 641 WSBool creationdate = 1;
641 642
642 WebdavPList *property = rq->properties; 643 WebdavPListIterator i = webdav_plist_iterator(plistInOut);
643 WebdavPList *prev = NULL; 644 WebdavPList *cur;
644 while(property) { 645 while(webdav_plist_iterator_next(&i, &cur)) {
645 WebdavPList *next = property->next; 646 WSNamespace *ns = cur->property->namespace;
646 WSNamespace *ns = property->property->namespace; 647 if(ns && !strcmp((const char*)ns->href, "DAV:")) {
647 if(ns && !strcmp((char*)ns->href, "DAV:")) { 648 const char *name = cur->property->name;
648 const char *name = property->property->name; 649 WSBool remove_prop = TRUE;
649 WebdavPList *removethis = property;
650 if(!strcmp(name, "getlastmodified")) { 650 if(!strcmp(name, "getlastmodified")) {
651 ret.getlastmodified = 1; 651 ret.getlastmodified = 1;
652 } else if(!strcmp(name, "getcontentlength")) { 652 } else if(!strcmp(name, "getcontentlength")) {
653 ret.getcontentlength = 1; 653 ret.getcontentlength = 1;
654 } else if(!strcmp(name, "resourcetype")) { 654 } else if(!strcmp(name, "resourcetype")) {
656 } else if(etag && !strcmp(name, "getetag")) { 656 } else if(etag && !strcmp(name, "getetag")) {
657 ret.getetag = 1; 657 ret.getetag = 1;
658 } else if(creationdate && !strcmp(name, "creationdate")) { 658 } else if(creationdate && !strcmp(name, "creationdate")) {
659 ret.creationdate = 1; 659 ret.creationdate = 1;
660 } else { 660 } else {
661 removethis = NULL; 661 remove_prop = FALSE;
662 } 662 }
663 663
664 if(removefromlist && removethis) { 664 if(remove_prop) {
665 665 webdav_plist_iterator_remove_current(&i);
666 if(prev) {
667 prev->next = next;
668 } else {
669 rq->properties = next;
670 }
671 } 666 }
672 } 667 }
673 prev = property;
674 property = next;
675 } 668 }
676 669
677 return ret; 670 return ret;
678 } 671 }
679 672

mercurial