diff --git a/AUTHORS b/AUTHORS index 77f802e12b..5fd81c08e3 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,2 +1,3 @@ Andreas Schneider Klaas Freitag +Olivier Goffart diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e0b83ef8e..c108193982 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ set(APPLICATION_NAME ${PROJECT_NAME}) set(APPLICATION_VERSION_MAJOR "0") set(APPLICATION_VERSION_MINOR "90") -set(APPLICATION_VERSION_PATCH "0") +set(APPLICATION_VERSION_PATCH "1") set(APPLICATION_VERSION "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}") diff --git a/ChangeLog b/ChangeLog index a858826c1c..e72f9b89a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,15 @@ ChangeLog ========== -version 0.90.0 (released 2013-09-04, ownCloud Client 1.4) +version 0.90.1 (released 2013-09-24, ownCloud Client 1.4.1) + * detect if server does not send an etag after an upload + completed. + * fix crash in case of network timeout, reported as + https://github.com/owncloud/mirall/issues/1010 + * compile and cmake fixes for win32 + * fixed behaviour of csync_exclude + * documentation and spelling fixes. + +version 0.90.0 (released 2013-09-04, ownCloud Client 1.4.0) * Added API to get progress information from csync. * Added c_rename function to csync std. * Fix: Do renames of files before any puts. diff --git a/doc/makeguide.sh b/doc/makeguide.sh old mode 100755 new mode 100644 diff --git a/doc/makeman.sh b/doc/makeman.sh old mode 100755 new mode 100644 diff --git a/modules/csync_owncloud.c b/modules/csync_owncloud.c index 8d602ea137..e9356e20a3 100644 --- a/modules/csync_owncloud.c +++ b/modules/csync_owncloud.c @@ -1099,6 +1099,13 @@ static const char* owncloud_file_id( const char *path ) cbuf = c_strdup(header); } } + + /* fix server problem: If we end up with an empty string, set something strange... */ + if( c_streq(cbuf, "") || c_streq(cbuf, "\"\"") ) { + SAFE_FREE(cbuf); + cbuf = c_strdup("empty_etag"); + } + DEBUG_WEBDAV("Get file ID for %s: %s", path, cbuf ? cbuf:""); if( fs ) csync_vio_file_stat_destroy(fs); if( req ) ne_request_destroy(req); diff --git a/src/csync_exclude.c b/src/csync_exclude.c index 854d55823b..dcb0d9b793 100644 --- a/src/csync_exclude.c +++ b/src/csync_exclude.c @@ -196,6 +196,8 @@ CSYNC_EXCLUDE_TYPE csync_excluded(CSYNC *ctx, const char *path, int filetype) { SAFE_FREE(dname); goto out; } + SAFE_FREE(bname); + SAFE_FREE(dname); SAFE_FREE(bname); SAFE_FREE(dname); diff --git a/src/csync_misc.h b/src/csync_misc.h index 0cded19ce6..754ca9afc1 100644 --- a/src/csync_misc.h +++ b/src/csync_misc.h @@ -35,6 +35,16 @@ #define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */ #endif +#ifdef HAVE_FNMATCH +#include +#else +/* Steal this define to make csync_exclude compile. Note that if fnmatch + * is not defined it's probably Win32 which uses a different implementation + * than fmmatch anyway, which does not care for flags. + **/ +#define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */ +#endif + char *csync_get_user_home_dir(void); char *csync_get_local_username(void); diff --git a/src/csync_util.c b/src/csync_util.c index 387903ee2b..a35fb14c98 100644 --- a/src/csync_util.c +++ b/src/csync_util.c @@ -154,12 +154,15 @@ static int _merge_file_trees_visitor(void *obj, void *data) { goto out; } new_stat = memcpy(new_stat, fs, sizeof(csync_file_stat_t) + fs->pathlen + 1); - if (fs->md5) + if (fs->md5) { new_stat->md5 = c_strdup(fs->md5); - if (fs->destpath) + } + if (fs->destpath) { new_stat->destpath = c_strdup(fs->destpath); - if (fs->error_string) + } + if (fs->error_string) { new_stat->error_string = c_strdup(fs->error_string); + } if (c_rbtree_insert(tree, new_stat) < 0) { C_STRERROR(errno, errbuf, sizeof(errbuf)); diff --git a/src/httpbf/src/httpbf.c b/src/httpbf/src/httpbf.c index 36b2c0ff0d..5c21fbb266 100644 --- a/src/httpbf/src/httpbf.c +++ b/src/httpbf/src/httpbf.c @@ -94,6 +94,7 @@ hbf_transfer_t *hbf_init_transfer( const char *dest_uri ) { transfer->start_id = 0; transfer->block_size = DEFAULT_BLOCK_SIZE; transfer->threshold = transfer->block_size; + transfer->modtime_accepted = 0; return transfer; } @@ -314,6 +315,13 @@ static int _hbf_dav_request(hbf_transfer_t *transfer, ne_request *req, int fd, h } else { /* DEBUG_HBF("OOOOOOOO No etag returned!"); */ } + + /* check if the server was able to set the mtime already. */ + etag = ne_get_response_header(req, "X-OC-MTime"); + if( etag && strcmp(etag, "accepted") == 0 ) { + /* the server acknowledged that the mtime was set. */ + transfer->modtime_accepted = 1; + } } break; case NE_AUTH: @@ -466,8 +474,14 @@ Hbf_State hbf_transfer( ne_session *session, hbf_transfer_t *transfer, const cha if( req ) { char buf[21]; + snprintf(buf, sizeof(buf), "%"PRId64, transfer->stat_size); ne_add_request_header(req, "OC-Total-Length", buf); + if( transfer->modtime > 0 ) { + snprintf(buf, sizeof(buf), "%"PRId64, transfer->modtime); + ne_add_request_header(req, "X_OC_Mtime", buf); + } + if( transfer->block_cnt > 1 ) { ne_add_request_header(req, "OC-Chunked", "1"); } @@ -531,6 +545,28 @@ int hbf_fail_http_code( hbf_transfer_t *transfer ) return 200; } +const char *hbf_transfer_etag( hbf_transfer_t *transfer ) +{ + int cnt; + const char *etag = NULL; + + if( ! transfer ) return 0; + + /* Loop over all parts and do a assertion that there is only one etag. */ + for( cnt = 0; cnt < transfer->block_cnt; cnt++ ) { + int block_id = (cnt + transfer->start_id) % transfer->block_cnt; + hbf_block_t *block = transfer->block_arr[block_id]; + if( block->etag ) { + if( etag && strcmp(etag, block->etag) != 0 ) { + /* multiple etags in the transfer, not equal. */ + DEBUG_HBF( "WARN: etags are not equal in blocks of one single transfer." ); + } + etag = block->etag; + } + } + return etag; +} + const char *hbf_error_string(hbf_transfer_t *transfer, Hbf_State state) { const char *re; diff --git a/src/httpbf/src/httpbf.h b/src/httpbf/src/httpbf.h index c315b55d76..53066ba420 100644 --- a/src/httpbf/src/httpbf.h +++ b/src/httpbf/src/httpbf.h @@ -97,6 +97,7 @@ struct hbf_transfer_s { hbf_abort_callback abort_cb; hbf_log_callback log_cb; + int modtime_accepted; #ifndef NDEBUG int64_t calc_size; @@ -113,6 +114,8 @@ void hbf_free_transfer( hbf_transfer_t *transfer ); const char *hbf_error_string(hbf_transfer_t* transfer, Hbf_State state); +const char *hbf_transfer_etag( hbf_transfer_t *transfer ); + void hbf_set_abort_callback( hbf_transfer_t *transfer, hbf_abort_callback cb); void hbf_set_log_callback( hbf_transfer_t *transfer, hbf_log_callback cb);