This commit is contained in:
Markus Goetz 2014-02-27 14:03:17 +01:00
Родитель 71cc74a0d6
Коммит 5d58a8164c
5 изменённых файлов: 0 добавлений и 83 удалений

Просмотреть файл

@ -891,68 +891,6 @@ static int owncloud_stat(const char *uri, csync_vio_file_stat_t *buf) {
return 0;
}
static const char* owncloud_get_etag( const char *path )
{
ne_request *req = NULL;
const char *header = NULL;
char *uri = _cleanPath(path);
char *cbuf = NULL;
csync_vio_file_stat_t *fs = NULL;
bool doHeadRequest = false;
if (_id_cache.uri && c_streq(path, _id_cache.uri)) {
header = _id_cache.id;
}
doHeadRequest= false; /* ownCloud server doesn't have good support for HEAD yet */
if( !header && doHeadRequest ) {
int neon_stat;
/* Perform an HEAD request to the resource. HEAD delivers the
* ETag header back. */
req = ne_request_create(dav_session.ctx, "HEAD", uri);
neon_stat = ne_request_dispatch(req);
set_errno_from_neon_errcode( neon_stat );
header = ne_get_response_header(req, "etag");
}
/* If the request went wrong or the server did not respond correctly
* (that can happen for collections) a stat call is done which translates
* into a PROPFIND request.
*/
if( ! header ) {
/* ... and do a stat call. */
fs = csync_vio_file_stat_new();
if(fs == NULL) {
DEBUG_WEBDAV( "owncloud_get_etag: memory fault.");
errno = ENOMEM;
return NULL;
}
if( owncloud_stat( path, fs ) == 0 ) {
header = fs->etag;
}
}
/* In case the result is surrounded by "" cut them away. */
if( header ) {
cbuf = csync_normalize_etag(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:"<null>");
if( fs ) csync_vio_file_stat_destroy(fs);
if( req ) ne_request_destroy(req);
SAFE_FREE(uri);
return cbuf;
}
/*
* directory functions
*/
@ -1152,7 +1090,6 @@ csync_vio_method_t _method = {
.set_property = owncloud_set_property,
.get_error_string = owncloud_error_string,
.commit = owncloud_commit,
.get_etag = owncloud_get_etag
};
csync_vio_method_t *vio_module_init(const char *method_name, const char *args,

Просмотреть файл

@ -81,10 +81,6 @@ int csync_vio_init(CSYNC *ctx, const char *module, const char *args) {
return -1;
}
if (! VIO_METHOD_HAS_FUNC(m, get_etag)) {
CSYNC_LOG(CSYNC_LOG_PRIORITY_WARN, "module %s has no get_etag fn", module);
}
ctx->module.method = m;
return 0;
@ -178,17 +174,6 @@ csync_vio_file_stat_t *csync_vio_readdir(CSYNC *ctx, csync_vio_handle_t *dhandle
}
const char *csync_vio_get_etag(CSYNC *ctx, const char *path)
{
const char *re = NULL;
/* We always use the remote method here. */
if(ctx->module.method &&
VIO_METHOD_HAS_FUNC(ctx->module.method, get_etag)) {
re = ctx->module.method->get_etag(path);
}
return re;
}
int csync_vio_stat(CSYNC *ctx, const char *uri, csync_vio_file_stat_t *buf) {
int rc = -1;

Просмотреть файл

@ -40,7 +40,6 @@ csync_vio_handle_t *csync_vio_opendir(CSYNC *ctx, const char *name);
int csync_vio_closedir(CSYNC *ctx, csync_vio_handle_t *dhandle);
csync_vio_file_stat_t *csync_vio_readdir(CSYNC *ctx, csync_vio_handle_t *dhandle);
const char *csync_vio_get_etag(CSYNC *ctx, const char *path);
int csync_vio_stat(CSYNC *ctx, const char *uri, csync_vio_file_stat_t *buf);
int csync_vio_set_property(CSYNC *ctx, const char *key, void *data);

Просмотреть файл

@ -30,6 +30,4 @@ csync_vio_file_stat_t *csync_vio_local_readdir(csync_vio_method_handle_t *dhandl
int csync_vio_local_stat(const char *uri, csync_vio_file_stat_t *buf);
int csync_vio_local_utimes(const char *uri, const struct timeval *times);
#endif /* _CSYNC_VIO_LOCAL_H */

Просмотреть файл

@ -37,7 +37,6 @@ typedef csync_vio_method_t *(*csync_vio_method_init_fn)(const char *method_name,
const char *config_args, csync_auth_callback cb, void *userdata);
typedef void (*csync_vio_method_finish_fn)(csync_vio_method_t *method);
typedef const char* (*csync_method_get_etag_fn)(const char* path);
typedef csync_vio_method_handle_t *(*csync_method_open_fn)(const char *durl, int flags, mode_t mode);
typedef csync_vio_method_handle_t *(*csync_method_creat_fn)(const char *durl, mode_t mode);
typedef int (*csync_method_close_fn)(csync_vio_method_handle_t *fhandle);
@ -84,7 +83,6 @@ struct csync_vio_method_s {
csync_method_set_property_fn set_property;
csync_method_get_error_string_fn get_error_string;
csync_method_commit_fn commit;
csync_method_get_etag_fn get_etag;
};
#endif /* _CSYNC_VIO_H */