1711 } else { |
1717 } else { |
1712 int changed = remote_resource_is_changed(sn, dir, db, res, local_res); |
1718 int changed = remote_resource_is_changed(sn, dir, db, res, local_res); |
1713 if(cdt && changed) { |
1719 if(cdt && changed) { |
1714 printf("conflict: %s\n", local_res->path); |
1720 printf("conflict: %s\n", local_res->path); |
1715 local_res->last_modified = 0; |
1721 local_res->last_modified = 0; |
|
1722 nullfree(local_res->etag); |
|
1723 local_res->etag = NULL; |
|
1724 nullfree(local_res->hash); |
|
1725 local_res->hash = NULL; |
1716 local_res->skipped = TRUE; |
1726 local_res->skipped = TRUE; |
1717 sync_skipped++; |
1727 sync_skipped++; |
1718 } else { |
1728 } else { |
1719 printf("put: %s\n", local_res->path); |
1729 printf("put: %s\n", local_res->path); |
1720 if(sync_put_resource(dir, res, local_res, &sync_success)) { |
1730 if(sync_put_resource(dir, res, local_res, &sync_success)) { |
1742 |
1752 |
1743 int err = 0; |
1753 int err = 0; |
1744 DavResource *res = dav_resource_new(sn, local->path); |
1754 DavResource *res = dav_resource_new(sn, local->path); |
1745 if(dav_exists(res)) { |
1755 if(dav_exists(res)) { |
1746 printf("conflict: %s\n", local->path); |
1756 printf("conflict: %s\n", local->path); |
|
1757 local->last_modified = 0; |
|
1758 nullfree(local->etag); |
|
1759 local->etag = NULL; |
|
1760 nullfree(local->hash); |
|
1761 local->hash = NULL; |
|
1762 local->skipped = TRUE; |
1747 sync_skipped++; |
1763 sync_skipped++; |
1748 } else { |
1764 } else { |
1749 DavResource *origin_res = dav_resource_new(sn, local->origin->path); |
1765 DavResource *origin_res = dav_resource_new(sn, local->origin->path); |
1750 int origin_changed = remote_resource_is_changed( |
1766 int origin_changed = remote_resource_is_changed( |
1751 sn, |
1767 sn, |
2376 |
2392 |
2377 int ret = 0; |
2393 int ret = 0; |
2378 if(err == 0) { |
2394 if(err == 0) { |
2379 char *etag = dav_get_string_property(remote, "D:getetag"); |
2395 char *etag = dav_get_string_property(remote, "D:getetag"); |
2380 char *hash = sync_get_content_hash(remote); |
2396 char *hash = sync_get_content_hash(remote); |
2381 if(hash || res->hash) { |
2397 if(hash && res->hash) { |
2382 if(!nullstrcmp(hash, res->hash)) { |
2398 if(!strcmp(hash, res->hash)) { |
2383 ret = 1; |
2399 ret = 1; |
2384 } |
2400 } |
2385 } else if(!res->etag) { |
2401 } else if(!res->etag) { |
2386 // the resource is on the server and the client has no etag |
2402 // the resource is on the server and the client has no etag |
2387 ret = 1; |
2403 ret = 1; |