[evolution-data-server/wip/offline-cache] e_webdav_session_delete_sync - let the 'depth' argument be optional
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/wip/offline-cache] e_webdav_session_delete_sync - let the 'depth' argument be optional
- Date: Tue, 16 May 2017 08:49:04 +0000 (UTC)
commit 7dbb6ccfba9f3fbff5312c6ee13484c6abed5b93
Author: Milan Crha <mcrha redhat com>
Date: Tue May 16 10:47:02 2017 +0200
e_webdav_session_delete_sync - let the 'depth' argument be optional
The calendar.gmx.com claims an error when it's not set to "inifinity", even
the RFC 4918 requires "infinity" depth only for collections, not for resources.
.../backends/webdav/e-book-backend-webdav.c | 6 +++---
.../backends/caldav/e-cal-backend-caldav.c | 6 +++---
src/libedataserver/e-webdav-session.c | 9 +++++----
3 files changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/src/addressbook/backends/webdav/e-book-backend-webdav.c
b/src/addressbook/backends/webdav/e-book-backend-webdav.c
index 9ffbace..12d4989 100644
--- a/src/addressbook/backends/webdav/e-book-backend-webdav.c
+++ b/src/addressbook/backends/webdav/e-book-backend-webdav.c
@@ -969,7 +969,7 @@ ebb_webdav_remove_contact_sync (EBookMetaBackend *meta_backend,
etag = e_vcard_util_dup_x_attribute (E_VCARD (contact), E_WEBDAV_X_ETAG);
success = e_webdav_session_delete_sync (bbdav->priv->webdav, extra,
- E_WEBDAV_DEPTH_THIS, etag, cancellable, &local_error);
+ NULL, etag, cancellable, &local_error);
if (g_error_matches (local_error, SOUP_HTTP_ERROR, SOUP_STATUS_NOT_FOUND)) {
gchar *href;
@@ -978,7 +978,7 @@ ebb_webdav_remove_contact_sync (EBookMetaBackend *meta_backend,
if (href) {
g_clear_error (&local_error);
success = e_webdav_session_delete_sync (bbdav->priv->webdav, href,
- E_WEBDAV_DEPTH_THIS, etag, cancellable, &local_error);
+ NULL, etag, cancellable, &local_error);
g_free (href);
}
@@ -988,7 +988,7 @@ ebb_webdav_remove_contact_sync (EBookMetaBackend *meta_backend,
if (href) {
g_clear_error (&local_error);
success = e_webdav_session_delete_sync (bbdav->priv->webdav, href,
- E_WEBDAV_DEPTH_THIS, etag, cancellable, &local_error);
+ NULL, etag, cancellable, &local_error);
g_free (href);
}
diff --git a/src/calendar/backends/caldav/e-cal-backend-caldav.c
b/src/calendar/backends/caldav/e-cal-backend-caldav.c
index f3800b7..d2ae19b 100644
--- a/src/calendar/backends/caldav/e-cal-backend-caldav.c
+++ b/src/calendar/backends/caldav/e-cal-backend-caldav.c
@@ -1115,7 +1115,7 @@ ecb_caldav_remove_component_sync (ECalMetaBackend *meta_backend,
etag = e_cal_util_dup_x_property (icalcomp, E_CALDAV_X_ETAG);
success = e_webdav_session_delete_sync (cbdav->priv->webdav, extra,
- E_WEBDAV_DEPTH_THIS, etag, cancellable, &local_error);
+ NULL, etag, cancellable, &local_error);
if (g_error_matches (local_error, SOUP_HTTP_ERROR, SOUP_STATUS_NOT_FOUND)) {
gchar *href;
@@ -1124,7 +1124,7 @@ ecb_caldav_remove_component_sync (ECalMetaBackend *meta_backend,
if (href) {
g_clear_error (&local_error);
success = e_webdav_session_delete_sync (cbdav->priv->webdav, href,
- E_WEBDAV_DEPTH_THIS, etag, cancellable, &local_error);
+ NULL, etag, cancellable, &local_error);
g_free (href);
}
@@ -1134,7 +1134,7 @@ ecb_caldav_remove_component_sync (ECalMetaBackend *meta_backend,
if (href) {
g_clear_error (&local_error);
success = e_webdav_session_delete_sync (cbdav->priv->webdav, href,
- E_WEBDAV_DEPTH_THIS, etag, cancellable, &local_error);
+ NULL, etag, cancellable, &local_error);
g_free (href);
}
diff --git a/src/libedataserver/e-webdav-session.c b/src/libedataserver/e-webdav-session.c
index 5752d8c..29f2f8a 100644
--- a/src/libedataserver/e-webdav-session.c
+++ b/src/libedataserver/e-webdav-session.c
@@ -2369,14 +2369,15 @@ e_webdav_session_put_data_sync (EWebDAVSession *webdav,
* e_webdav_session_delete_sync:
* @webdav: an #EWebDAVSession
* @uri: URI of the resource to delete
- * @depth: requested depth, can be one of %E_WEBDAV_DEPTH_THIS or %E_WEBDAV_DEPTH_INFINITY
+ * @depth: (nullable): optional requested depth, can be one of %E_WEBDAV_DEPTH_THIS or
%E_WEBDAV_DEPTH_INFINITY, or %NULL
* @etag: (nullable): an optional ETag of the resource, or %NULL
* @cancellable: optional #GCancellable object, or %NULL
* @error: return location for a #GError, or %NULL
*
* Deletes a resource identified by @uri on the server. The URI can
* reference a collection, in which case @depth should be %E_WEBDAV_DEPTH_INFINITY.
- * Use @depth %E_WEBDAV_DEPTH_THIS when deleting a regular resource.
+ * Use @depth %E_WEBDAV_DEPTH_THIS when deleting a regular resource, or %NULL,
+ * to let the server use default Depth.
*
* The @etag argument is used to avoid clashes when overwriting existing resources.
* Use %NULL @etag when deleting collection resources or to force the deletion,
@@ -2405,7 +2406,6 @@ e_webdav_session_delete_sync (EWebDAVSession *webdav,
g_return_val_if_fail (E_IS_WEBDAV_SESSION (webdav), FALSE);
g_return_val_if_fail (uri != NULL, FALSE);
- g_return_val_if_fail (depth != NULL, FALSE);
request = e_webdav_session_new_request (webdav, SOUP_METHOD_DELETE, uri, error);
if (!request)
@@ -2446,7 +2446,8 @@ e_webdav_session_delete_sync (EWebDAVSession *webdav,
}
}
- soup_message_headers_replace (message->request_headers, "Depth", depth);
+ if (depth)
+ soup_message_headers_replace (message->request_headers, "Depth", depth);
bytes = e_soup_session_send_request_simple_sync (E_SOUP_SESSION (webdav), request, cancellable,
error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]