fixed href comparison in parse_response_tag

Wed, 14 Oct 2015 16:07:54 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Wed, 14 Oct 2015 16:07:54 +0200
changeset 164
4c204e40ef52
parent 163
c6d05f646b59
child 165
b66bed169fc3

fixed href comparison in parse_response_tag

libidav/methods.c file | annotate | diff | comparison | revisions
--- a/libidav/methods.c	Wed Oct 14 14:37:08 2015 +0200
+++ b/libidav/methods.c	Wed Oct 14 16:07:54 2015 +0200
@@ -563,21 +563,15 @@
                 //char *href = (char*)href_node->content;
                 href = util_url_path((char*)href_node->content);
                 
-                sstr_t href_s = sstr(util_url_decode(resource->session, href));
-                sstr_t href_r = sstr(util_url_decode(resource->session, resource->href));
-                if(!sstrcmp(href_s, href_r)) {
+                char *href_s = util_url_decode(resource->session, href);
+                char *href_r = util_url_decode(resource->session, resource->href);
+                
+                if(hrefeq(sn, href_s, href_r)) {
                     res = 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;
-                        }
-                    }
-                }
+                }   
                 
-                free(href_s.ptr);
-                free(href_r.ptr);
+                free(href_s);
+                free(href_r);
             } else if(xstreq(node->name, "propstat")) {
                 xmlNode *n = node->children;
                 xmlNode *prop_node = NULL;

mercurial