libidav/methods.c

changeset 135
664aeaec8d25
parent 128
649eb328674a
child 137
01cb9aabff05
equal deleted inserted replaced
134:4bccc18820e8 135:664aeaec8d25
30 #include <stdlib.h> 30 #include <stdlib.h>
31 #include <string.h> 31 #include <string.h>
32 32
33 #include "utils.h" 33 #include "utils.h"
34 #include "methods.h" 34 #include "methods.h"
35 #include "davql.h"
36 #include "crypto.h" 35 #include "crypto.h"
37 #include "session.h" 36 #include "session.h"
38 37
39 #define xstreq(a,b) xmlStrEqual(BAD_CAST a, BAD_CAST b) 38 #define xstreq(a,b) xmlStrEqual(BAD_CAST a, BAD_CAST b)
40 39
373 372
374 return ret; 373 return ret;
375 } 374 }
376 375
377 376
378 DavResource* parse_propfind_response(DavSession *sn, DavResource *root, UcxBuffer *response, DavQOp *cond, size_t len) { 377 DavResource* parse_propfind_response(DavSession *sn, DavResource *root, UcxBuffer *response) {
379 char *url = NULL; 378 char *url = NULL;
380 curl_easy_getinfo(sn->handle, CURLINFO_EFFECTIVE_URL, &url); 379 curl_easy_getinfo(sn->handle, CURLINFO_EFFECTIVE_URL, &url);
381 if(!root) { 380 if(!root) {
382 printf("method.c: TODO: remove\n"); 381 printf("method.c: TODO: remove\n");
383 root = dav_resource_new_href(sn, util_url_path(url)); // TODO: remove 382 root = dav_resource_new_href(sn, util_url_path(url)); // TODO: remove
394 xmlNode *xml_root = xmlDocGetRootElement(doc); 393 xmlNode *xml_root = xmlDocGetRootElement(doc);
395 xmlNode *node = xml_root->children; 394 xmlNode *node = xml_root->children;
396 while(node) { 395 while(node) {
397 if(node->type == XML_ELEMENT_NODE) { 396 if(node->type == XML_ELEMENT_NODE) {
398 if(xstreq(node->name, "response")) { 397 if(xstreq(node->name, "response")) {
399 parse_response_tag(root, node, cond, len); 398 parse_response_tag(root, node);
400 } 399 }
401 } 400 }
402 node = node->next; 401 node = node->next;
403 } 402 }
404 xmlFreeDoc(doc); 403 xmlFreeDoc(doc);
461 } 460 }
462 461
463 set_davprops(res); 462 set_davprops(res);
464 } 463 }
465 464
466 int parse_response_tag(DavResource *resource, xmlNode *node, DavQOp *cond, size_t clen) { 465 int parse_response_tag(DavResource *resource, xmlNode *node) {
467 DavSession *sn = resource->session; 466 DavSession *sn = resource->session;
468 467
469 //DavResource *res = resource; 468 //DavResource *res = resource;
470 DavResource *res = NULL; 469 DavResource *res = NULL;
471 char *href = NULL; 470 char *href = NULL;
605 } 604 }
606 ucx_list_free(properties); 605 ucx_list_free(properties);
607 606
608 set_davprops(res); 607 set_davprops(res);
609 if(res != resource) { 608 if(res != resource) {
610 if(clen > 0) {
611 if(!condition_eval(res, cond, clen)) {
612 // skip resource
613 return 0;
614 }
615 }
616 resource_add_child(resource, res); 609 resource_add_child(resource, res);
617 } 610 }
618 611
619 return 0; 612 return 0;
620 } 613 }

mercurial