dav/main.c

branch
v1.2
changeset 481
ff477f1f7765
parent 425
ae4d89c3477c
child 484
9435cb1ddf76
--- a/dav/main.c	Sun Oct 07 09:14:03 2018 +0200
+++ b/dav/main.c	Thu Oct 11 19:29:45 2018 +0200
@@ -1137,7 +1137,7 @@
         if(e->type == TAR_TYPE_FILE) {
             fprintf(stderr, "put: %s\n", e->path);
             DavResource *res = dav_resource_new(sn, newpath);
-            dav_set_content(res, tar, (dav_read_func)tar_fread);
+            dav_set_content(res, tar, (dav_read_func)tar_fread, (dav_seek_func)tar_seek);
             dav_set_content_length(res, (size_t)e->size);
 
             if(dav_store(res)) {
@@ -1178,6 +1178,11 @@
     return ret;
 }
 
+static int file_seek(FILE *f, curl_off_t offset, int origin) {
+    int ret = fseek(f, offset, origin);
+    return ret == 0 ? CURL_SEEKFUNC_OK : CURL_SEEKFUNC_CANTSEEK;
+}
+
 int put_file(Repository *repo, CmdArgs *a, DavSession *sn, char *path, char *name, FILE *in, off_t len) {
     DavResource *res = dav_query(sn, "select - from %s", path);
     
@@ -1212,7 +1217,7 @@
         return ret;
     }
     
-    dav_set_content(res, in, (dav_read_func)fread);
+    dav_set_content(res, in, (dav_read_func)fread, (dav_seek_func)file_seek);
     if(len > 0 && len < 0x7d000000) {
         dav_set_content_length(res, (size_t)len);
     }

mercurial