evolution-data-server r10109 - in trunk/calendar: . backends/caldav
- From: mcrha svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-data-server r10109 - in trunk/calendar: . backends/caldav
- Date: Fri, 27 Feb 2009 15:04:04 +0000 (UTC)
Author: mcrha
Date: Fri Feb 27 15:04:04 2009
New Revision: 10109
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=10109&view=rev
Log:
2009-02-27 Milan Crha <mcrha redhat com>
** Fix for bug #572566
* backends/caldav/e-cal-backend-caldav.c: (e_cal_component_set_href),
(e_cal_component_get_href), (e_cal_component_set_etag),
(e_cal_component_get_etag): Do not set/access NULL pointers.
* backends/caldav/e-cal-backend-caldav.c: (caldav_server_put_object):
When no ETag is returned, try to GET it first, before giving up.
* backends/caldav/e-cal-backend-caldav.c: (caldav_create_object),
(caldav_modify_object), (caldav_remove_object), (process_object):
Set etag/href on success only.
Modified:
trunk/calendar/ChangeLog
trunk/calendar/backends/caldav/e-cal-backend-caldav.c
Modified: trunk/calendar/backends/caldav/e-cal-backend-caldav.c
==============================================================================
--- trunk/calendar/backends/caldav/e-cal-backend-caldav.c (original)
+++ trunk/calendar/backends/caldav/e-cal-backend-caldav.c Fri Feb 27 15:04:04 2009
@@ -313,7 +313,10 @@
{
icalcomponent *icomp;
+ g_return_if_fail (href != NULL);
+
icomp = e_cal_component_get_icalcomponent (comp);
+ g_return_if_fail (icomp != NULL);
icomp_x_prop_set (icomp, X_E_CALDAV "HREF", href);
}
@@ -326,6 +329,7 @@
str = NULL;
icomp = e_cal_component_get_icalcomponent (comp);
+ g_return_val_if_fail (icomp != NULL, NULL);
str = icomp_x_prop_get (icomp, X_E_CALDAV "HREF");
@@ -338,11 +342,12 @@
{
icalcomponent *icomp;
+ g_return_if_fail (etag != NULL);
+
icomp = e_cal_component_get_icalcomponent (comp);
+ g_return_if_fail (icomp != NULL);
icomp_x_prop_set (icomp, X_E_CALDAV "ETAG", etag);
-
-
}
static char *
@@ -353,6 +358,7 @@
str = NULL;
icomp = e_cal_component_get_icalcomponent (comp);
+ g_return_val_if_fail (icomp != NULL, NULL);
str = icomp_x_prop_get (icomp, X_E_CALDAV "ETAG");
@@ -1261,15 +1267,25 @@
result = status_code_to_result (message->status_code, priv);
if (result == GNOME_Evolution_Calendar_Success) {
- hdr = soup_message_headers_get (message->response_headers,
- "ETag");
- }
+ hdr = soup_message_headers_get (message->response_headers, "ETag");
+ if (hdr != NULL) {
+ g_free (object->etag);
+ object->etag = quote_etag (hdr);
+ } else {
+ /* no ETag header returned, check for it with a GET */
+ hdr = soup_message_headers_get (message->response_headers, "Location");
+ if (hdr) {
+ /* reflect possible href change first */
+ char *file = strrchr (hdr, '/');
+
+ if (file) {
+ g_free (object->href);
+ object->href = soup_uri_encode (file + 1, NULL);
+ }
+ }
- if (hdr != NULL) {
- g_free (object->etag);
- object->etag = quote_etag (hdr);
- } else {
- g_warning ("Ups no Etag in put response");
+ result = caldav_server_get_object (cbdav, object);
+ }
}
g_object_unref (message);
@@ -2018,7 +2034,6 @@
if (online) {
CalDAVObject object;
- const char *id = NULL;
href = e_cal_component_gen_href (comp);
@@ -2027,12 +2042,12 @@
object.cdata = pack_cobj (cbdav, comp);
status = caldav_server_put_object (cbdav, &object);
+ if (status == GNOME_Evolution_Calendar_Success) {
+ e_cal_component_set_href (comp, object.href);
+ e_cal_component_set_etag (comp, object.etag);
+ }
- e_cal_component_get_uid (comp, &id);
- e_cal_component_set_href (comp, object.href);
- e_cal_component_set_etag (comp, object.etag);
caldav_object_free (&object, FALSE);
-
} else {
/* mark component as out of synch */
e_cal_component_set_synch_state (comp,
@@ -2114,11 +2129,12 @@
object.cdata = pack_cobj (cbdav, comp);
status = caldav_server_put_object (cbdav, &object);
+ if (status == GNOME_Evolution_Calendar_Success) {
+ e_cal_component_set_href (comp, object.href);
+ e_cal_component_set_etag (comp, object.etag);
+ }
- e_cal_component_set_href (comp, object.href);
- e_cal_component_set_etag (comp, object.etag);
caldav_object_free (&object, FALSE);
-
} else {
/* mark component as out of synch */
e_cal_component_set_synch_state (comp,
@@ -2197,8 +2213,10 @@
caldav_object.cdata = pack_cobj (cbdav, cache_comp);
status = caldav_server_put_object (cbdav, &caldav_object);
- e_cal_component_set_href (cache_comp, caldav_object.href);
- e_cal_component_set_etag (cache_comp, caldav_object.etag);
+ if (status == GNOME_Evolution_Calendar_Success) {
+ e_cal_component_set_href (cache_comp, caldav_object.href);
+ e_cal_component_set_etag (cache_comp, caldav_object.etag);
+ }
} else
status = caldav_server_delete_object (cbdav, &caldav_object);
@@ -2347,12 +2365,15 @@
if (!is_declined) {
object.cdata = pack_cobj (cbdav, ecomp);
status = caldav_server_put_object (cbdav, &object);
+
+ if (status == GNOME_Evolution_Calendar_Success) {
+ e_cal_component_set_href (ecomp, object.href);
+ e_cal_component_set_etag (ecomp, object.etag);
+ }
} else {
object.cdata = NULL;
status = caldav_server_delete_object (cbdav, &object);
}
- e_cal_component_set_href (ecomp, object.href);
- e_cal_component_set_etag (ecomp, object.etag);
caldav_object_free (&object, FALSE);
}
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]