libidav/webdav.c

changeset 609
dc3d70848c7c
parent 607
5dc7fe41e8f8
child 645
ad61c1654dce
--- a/libidav/webdav.c	Fri Jul 12 16:59:08 2019 +0200
+++ b/libidav/webdav.c	Sun Jul 28 13:07:53 2019 +0200
@@ -186,6 +186,26 @@
     return ucx_map_sstr_get(context->namespaces, prefix);
 }
 
+int dav_enable_namespace_encryption(DavContext *context, const char *ns, DavBool encrypt) {
+    DavNSInfo *info = ucx_map_cstr_get(context->namespaceinfo, ns);
+    if(!info) {
+        info = calloc(1, sizeof(DavNSInfo));
+        info->encrypt = encrypt;
+        ucx_map_cstr_put(context->namespaceinfo, ns, info);
+    } else {
+        info->encrypt = encrypt;
+    }
+    return 0;
+}
+
+int dav_namespace_is_encrypted(DavContext *context, const char *ns) {
+    DavNSInfo *info = ucx_map_cstr_get(context->namespaceinfo, ns);
+    if(info) {
+        return info->encrypt;
+    }
+    return 0;
+}
+
 void dav_get_property_namespace_str(
         DavContext *ctx,
         char *prefixed_name,
@@ -301,7 +321,7 @@
 int dav_propfind(DavSession *sn, DavResource *root, UcxBuffer *rqbuf) {
     // clean resource properties
     DavResourceData *data = root->data;
-    ucx_map_clear(data->properties);
+    ucx_map_clear(data->properties); // TODO: free existing content
     
     CURL *handle = sn->handle;
     util_set_url(sn, dav_resource_get_href(root));
@@ -315,6 +335,7 @@
     if(ret == CURLE_OK && status == 207) {
         //printf("response\n%s\n", rpbuf->space); 
         dav_set_effective_href(sn, resource);
+        // TODO: use PropfindParser
         resource = parse_propfind_response(sn, resource, rpbuf);
         sn->error = DAV_OK;
         root->exists = 1;

mercurial