fixed propfind response parser bug

Mon, 01 Sep 2014 17:09:18 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Mon, 01 Sep 2014 17:09:18 +0200
changeset 60
cdca2eef48ee
parent 59
ec68175aad25
child 61
e9b102d5a6f6
child 62
3b813c57c106

fixed propfind response parser bug

libidav/methods.c file | annotate | diff | comparison | revisions
--- a/libidav/methods.c	Tue Aug 05 14:05:11 2014 +0200
+++ b/libidav/methods.c	Mon Sep 01 17:09:18 2014 +0200
@@ -278,11 +278,18 @@
                 }
                 //char *href = (char*)href_node->content;
                 href = util_url_path((char*)href_node->content);
-                if(xstreq(resource->href, href)) {
+                
+                sstr_t href_s = sstr((char*)href);
+                sstr_t href_r = sstr(resource->href);
+                if(!sstrcmp(href_s, href_r)) {
                     res = resource;
-                } else {
-                    //res = dav_resource_new_href(resource->session, href);
-                    //res->parent = resource;
+                } else if(href_s.length == href_r.length + 1) {
+                    if(href_s.ptr[href_s.length-1] == '/') {
+                        href_s.length--;
+                        if(!sstrcmp(href_s, href_r)) {
+                            res = resource;
+                        }
+                    }
                 }
             } else if(xstreq(node->name, "propstat")) {
                 xmlNode *n = node->children;

mercurial