From de9dcbd231924c9073a2e272bc4ec833828950e6 Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Wed, 25 Sep 2013 14:24:31 +0200 Subject: [PATCH] Transmit the new mtime of the file with the PUT request. If the server supports it already, we can save another request by sending the mtime as a header value in the PUT request and check the servers reply for a acknoledge header. --- src/mirall/owncloudpropagator.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/mirall/owncloudpropagator.cpp b/src/mirall/owncloudpropagator.cpp index 82c9533c6..c9be47f0c 100644 --- a/src/mirall/owncloudpropagator.cpp +++ b/src/mirall/owncloudpropagator.cpp @@ -221,6 +221,8 @@ csync_instructions_e OwncloudPropagator::uploadFile(const SyncFileItem &item) bool finished = true; int attempts = 0; + + _etag.clear(); // dangerous? /* * do ten tries to upload the file chunked. Check the file size and mtime * before submitting a chunk and after having submitted the last one. @@ -254,6 +256,10 @@ csync_instructions_e OwncloudPropagator::uploadFile(const SyncFileItem &item) state = hbf_transfer( _session, trans.data(), "PUT" ); } + if( trans->modtime_accepted ) { + _etag = QByteArray(hbf_transfer_etag( trans.data() )); + } + /* Handle errors. */ if ( state != HBF_SUCCESS ) { @@ -283,8 +289,9 @@ csync_instructions_e OwncloudPropagator::uploadFile(const SyncFileItem &item) } while( !finished ); ne_set_notifier(_session, 0, 0); - - updateMTimeAndETag(uri.data(), item._modtime); + if( _etag.isEmpty() ) { + updateMTimeAndETag(uri.data(), item._modtime); + } return CSYNC_INSTRUCTION_UPDATED; }