libidav/methods.c

branch
v1.2
changeset 481
ff477f1f7765
parent 373
dcc03142eb5f
--- a/libidav/methods.c	Sun Oct 07 09:14:03 2018 +0200
+++ b/libidav/methods.c	Thu Oct 11 19:29:45 2018 +0200
@@ -40,6 +40,11 @@
 
 #define xstreq(a,b) xmlStrEqual(BAD_CAST a, BAD_CAST b)
 
+
+int dav_buffer_seek(UcxBuffer *b, curl_off_t offset, int origin) {
+    return ucx_buffer_seek(b, offset, origin) == 0 ? 0:CURL_SEEKFUNC_CANTSEEK;
+}
+
 /* ----------------------------- PROPFIND ----------------------------- */
 
 CURLcode do_propfind_request(
@@ -60,6 +65,7 @@
     
     curl_easy_setopt(handle, CURLOPT_UPLOAD, 1); 
     curl_easy_setopt(handle, CURLOPT_READFUNCTION, ucx_buffer_read);
+    curl_easy_setopt(handle, CURLOPT_SEEKFUNCTION, dav_buffer_seek);
     curl_easy_setopt(handle, CURLOPT_READDATA, request); 
     curl_easy_setopt(handle, CURLOPT_INFILESIZE, request->size);
     
@@ -732,6 +738,7 @@
     
     curl_easy_setopt(handle, CURLOPT_UPLOAD, 1); 
     curl_easy_setopt(handle, CURLOPT_READFUNCTION, ucx_buffer_read);
+    curl_easy_setopt(handle, CURLOPT_SEEKFUNCTION, dav_buffer_seek);
     curl_easy_setopt(handle, CURLOPT_READDATA, request); 
     curl_easy_setopt(handle, CURLOPT_INFILESIZE, request->size);
     
@@ -920,7 +927,7 @@
     return s*n;
 }
 
-CURLcode do_put_request(DavSession *sn, char *lock, DavBool create, void *data, dav_read_func read_func, size_t length) {
+CURLcode do_put_request(DavSession *sn, char *lock, DavBool create, void *data, dav_read_func read_func, dav_seek_func seek_func, size_t length) {
     CURL *handle = sn->handle;
     curl_easy_setopt(handle, CURLOPT_CUSTOMREQUEST, NULL);
     curl_easy_setopt(handle, CURLOPT_UPLOAD, 1L);
@@ -960,6 +967,7 @@
     }
     
     curl_easy_setopt(handle, CURLOPT_READFUNCTION, read_func);
+    curl_easy_setopt(handle, CURLOPT_SEEKFUNCTION, seek_func);
     curl_easy_setopt(handle, CURLOPT_READDATA, data);
     
     curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, dummy_write);
@@ -1189,6 +1197,7 @@
     
     curl_easy_setopt(handle, CURLOPT_UPLOAD, 1); 
     curl_easy_setopt(handle, CURLOPT_READFUNCTION, ucx_buffer_read);
+    curl_easy_setopt(handle, CURLOPT_SEEKFUNCTION, dav_buffer_seek);
     curl_easy_setopt(handle, CURLOPT_READDATA, request); 
     curl_easy_setopt(handle, CURLOPT_INFILESIZE, request->size);
     

mercurial