libidav/resource.c

changeset 525
26a1d5b9d9d2
parent 518
cca3e7aa30ed
child 542
060a8cda7f62
--- a/libidav/resource.c	Fri Mar 15 20:30:09 2019 +0100
+++ b/libidav/resource.c	Sun Mar 17 15:00:48 2019 +0100
@@ -907,6 +907,7 @@
     int r = 0;
     if(ret == CURLE_OK && (status >= 200 && status < 300)) {
         res->session->error = DAV_OK;
+        res->exists = 0;
         
         // TODO: parse response
         // TODO: free res
@@ -1012,6 +1013,7 @@
     int status;
     if(!create_resource(res, &status)) {
         // resource successfully created
+        res->exists = 1;
         return 0;
     }
     
@@ -1036,9 +1038,13 @@
     long status = 0;
     curl_easy_getinfo (handle, CURLINFO_RESPONSE_CODE, &status);
     if(ret == CURLE_OK && (status >= 200 && status < 300)) {
+        res->exists = 1;
         return 1;
     } else {
         dav_session_set_error(sn, ret, status);
+        if(status == 404) {
+            res->exists = 0;
+        }
         return 0;
     }
 }

mercurial