# HG changeset patch # User Olaf Wintermann # Date 1707322315 -3600 # Node ID b41630ecc4815563283745982538fa979a3f8068 # Parent 673a803d220337d927d6ec0b7b109a4c01a3ccaf add support for progress callbacks in dav_store() diff -r 673a803d2203 -r b41630ecc481 libidav/resource.c --- a/libidav/resource.c Tue Feb 06 13:29:31 2024 +0100 +++ b/libidav/resource.c Wed Feb 07 17:11:55 2024 +0100 @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include #include "resource.h" @@ -787,7 +787,7 @@ } int dav_load_prop(DavResource *res, DavPropName *properties, size_t numprop) { - CxMempool *mp = cxBasicMempoolCreate(64); + CxMempool *mp = cxMempoolCreate(64, NULL); const CxAllocator *a = mp->allocator; CxList *proplist = cxArrayListCreate(a, NULL, sizeof(DavProperty), numprop); @@ -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);