mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-24 21:35:47 +03:00
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.
This commit is contained in:
parent
00fff7f793
commit
de9dcbd231
1 changed files with 9 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue