libidav/resource.c

changeset 20
db263186edf3
parent 1
b5bb7b3cd597
child 49
2f71f4ee247a
--- a/libidav/resource.c	Tue Feb 06 19:01:52 2024 +0100
+++ b/libidav/resource.c	Wed Feb 07 17:10:01 2024 +0100
@@ -856,6 +856,10 @@
     
     // store content
     if(data->content) {
+        curl_easy_setopt(sn->handle, CURLOPT_XFERINFOFUNCTION, dav_session_put_progress);
+        curl_easy_setopt(sn->handle, CURLOPT_XFERINFODATA, res);
+        curl_easy_setopt(sn->handle, CURLOPT_NOPROGRESS, 0L);
+
         int encryption = DAV_ENCRYPT_CONTENT(sn) && sn->key;
         CURLcode ret;
         if(encryption) {
@@ -900,6 +904,8 @@
             // TODO: store the properties later
             if(resource_add_crypto_info(sn, res->href, res->name, enc_hash)) {
                 free(enc_hash);
+                curl_easy_setopt(sn->handle, CURLOPT_XFERINFOFUNCTION, NULL);
+                curl_easy_setopt(sn->handle, CURLOPT_NOPROGRESS, 1L);
                 return 1;
             }
             resource_add_string_property(res, DAV_NS, "crypto-hash", enc_hash);
@@ -948,6 +954,9 @@
                     data->seek,
                     data->length);
         }
+
+        curl_easy_setopt(sn->handle, CURLOPT_XFERINFOFUNCTION, NULL);
+        curl_easy_setopt(sn->handle, CURLOPT_NOPROGRESS, 1L);
         
         long status = 0;
         curl_easy_getinfo(sn->handle, CURLINFO_RESPONSE_CODE, &status);

mercurial