dav/sync.c

changeset 227
bf485439222a
parent 225
a297c2e28fa1
child 228
c0175372c35d
equal deleted inserted replaced
226:acc997e0d0f9 227:bf485439222a
778 printf("mkcol: %s\n", local_res->path); 778 printf("mkcol: %s\n", local_res->path);
779 if(sync_mkdir(dir, res, local_res) && sn->error != DAV_METHOD_NOT_ALLOWED) { 779 if(sync_mkdir(dir, res, local_res) && sn->error != DAV_METHOD_NOT_ALLOWED) {
780 print_resource_error(sn, res->path); 780 print_resource_error(sn, res->path);
781 ret = -1; 781 ret = -1;
782 sync_error++; 782 sync_error++;
783 error = 1;
783 } 784 }
784 } else { 785 } else {
785 if(cdt && remote_resource_is_changed(sn, dir, db, local_res)) { 786 if(cdt && remote_resource_is_changed(sn, dir, db, local_res)) {
786 printf("conflict: %s\n", local_res->path); 787 printf("conflict: %s\n", local_res->path);
787 sync_skipped++; 788 sync_skipped++;
791 printf("put: %s\n", local_res->path); 792 printf("put: %s\n", local_res->path);
792 if(sync_put_resource(dir, res, local_res, &sync_success)) { 793 if(sync_put_resource(dir, res, local_res, &sync_success)) {
793 sync_error++; 794 sync_error++;
794 print_resource_error(sn, res->path); 795 print_resource_error(sn, res->path);
795 ret = -1; 796 ret = -1;
796 sync_error++;
797 error = 1; 797 error = 1;
798 } 798 }
799 } 799 }
800 dav_resource_free(res); 800 dav_resource_free(res);
801 } 801 }
1100 1100
1101 if(ret == 0) { 1101 if(ret == 0) {
1102 (*counter)++; 1102 (*counter)++;
1103 1103
1104 // check contentlength and get new etag 1104 // check contentlength and get new etag
1105 DavResource *up_res = dav_get(res->session, res->path, "D:getetag"); 1105 DavResource *up_res = dav_get(res->session, res->path, "D:getetag,idav:status");
1106 1106
1107 if(up_res) { 1107 if(up_res) {
1108 // the new content length must be equal or greater than the file size 1108 // the new content length must be equal or greater than the file size
1109 if(up_res->contentlength < s.st_size) { 1109 if(up_res->contentlength < s.st_size) {
1110 fprintf(stderr, "Incomplete Upload: %s", local_path); 1110 fprintf(stderr, "Incomplete Upload: %s", local_path);
1127 if(etag) { 1127 if(etag) {
1128 local->etag = strdup(etag); 1128 local->etag = strdup(etag);
1129 } else { 1129 } else {
1130 local->etag = NULL; 1130 local->etag = NULL;
1131 } 1131 }
1132
1133 if(dav_get_property(up_res, "idav:status")) {
1134 sync_remove_status(up_res);
1135 }
1136
1132 dav_resource_free(up_res); 1137 dav_resource_free(up_res);
1133
1134 sync_remove_status(res);
1135 } 1138 }
1136 } 1139 }
1137 } else { 1140 } else {
1138 ret = -1; 1141 ret = -1;
1139 sync_set_status(res, "broken"); 1142 sync_set_status(res, "broken");

mercurial