libidav/resource.c

changeset 103
6606616eca9f
parent 102
64ded9f6a6c6
child 108
77254bd6dccb
--- a/libidav/resource.c	Tue Feb 25 21:11:00 2025 +0100
+++ b/libidav/resource.c	Sat Apr 05 16:46:11 2025 +0200
@@ -823,11 +823,11 @@
 static size_t dav_read_h(void *buf, size_t size, size_t nelm, void *stream) {
     HashStream *s = stream;
     if(!s->sha) {
-        s->sha = dav_hash_init();
+        s->sha = dav_sha256_create();
     }
      
     size_t r = s->read(buf, size, nelm, s->stream);
-    dav_hash_update(s->sha, buf, r);
+    dav_sha256_update(s->sha, buf, r);
     return r;
 }
 
@@ -835,7 +835,7 @@
     HashStream *s = stream;
     if(offset == 0 && whence == SEEK_SET) {
         unsigned char buf[DAV_SHA256_DIGEST_LENGTH];
-        dav_hash_final(s->sha, buf);
+        dav_sha256_final(s->sha, buf);
         s->sha = NULL;
     } else {
         s->error = 1;
@@ -938,7 +938,7 @@
                     data->length);
             
             if(hstr.sha) {
-                dav_hash_final(hstr.sha, (unsigned char*)data->hash);
+                dav_sha256_final(hstr.sha, (unsigned char*)data->hash);
                 char *hash = util_hexstr((unsigned char*)data->hash, 32);
                 dav_set_string_property_ns(res, DAV_NS, "content-hash", hash);
                 free(hash);
@@ -1115,7 +1115,6 @@
     
     curl_easy_setopt(handle, CURLOPT_HTTPHEADER, NULL);
     curl_easy_setopt(handle, CURLOPT_CUSTOMREQUEST, NULL);
-    curl_easy_setopt(handle, CURLOPT_PUT, 0L);
     curl_easy_setopt(handle, CURLOPT_UPLOAD, 0L);
     
     curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, write_fnc);
@@ -1662,7 +1661,6 @@
     
     curl_easy_setopt(in->c, CURLOPT_HTTPHEADER, NULL);
     curl_easy_setopt(in->c, CURLOPT_CUSTOMREQUEST, NULL);
-    curl_easy_setopt(in->c, CURLOPT_PUT, 0L);
     curl_easy_setopt(in->c, CURLOPT_UPLOAD, 0L);
     
     curl_multi_add_handle(in->m, in->c);
@@ -1800,7 +1798,6 @@
     curl_easy_setopt(out->c, CURLOPT_HEADERFUNCTION, NULL);
     curl_easy_setopt(out->c, CURLOPT_HTTPHEADER, NULL);
     curl_easy_setopt(out->c, CURLOPT_CUSTOMREQUEST, NULL);
-    curl_easy_setopt(out->c, CURLOPT_PUT, 1L);
     curl_easy_setopt(out->c, CURLOPT_UPLOAD, 1L);
     curl_easy_setopt(out->c, CURLOPT_READFUNCTION, read_fnc);
     curl_easy_setopt(out->c, CURLOPT_READDATA, stream);

mercurial