[evolution-data-server] Calendar: Correct handling of a "not modified" On The Web calendar



commit d337f64327e033e142c6dc5c3ff10a02606ad17a
Author: Milan Crha <mcrha redhat com>
Date:   Mon Jul 11 12:16:40 2022 +0200

    Calendar: Correct handling of a "not modified" On The Web calendar
    
    The code printed a runtime warning on the calendar factory console
    due to not input stream being passed forward when the calendar
    did not modify since the last refresh.

 src/calendar/backends/http/e-cal-backend-http.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/calendar/backends/http/e-cal-backend-http.c b/src/calendar/backends/http/e-cal-backend-http.c
index 90b64cb07..e11de10b3 100644
--- a/src/calendar/backends/http/e-cal-backend-http.c
+++ b/src/calendar/backends/http/e-cal-backend-http.c
@@ -300,7 +300,8 @@ ecb_http_connect_sync (ECalMetaBackend *meta_backend,
                        uri, local_error ? local_error->message : _("Unknown error"));
        }
 
-       if (success) {
+       /* The 'input_stream' can be NULL when the server returned SOUP_STATUS_NOT_MODIFIED */
+       if (success && input_stream) {
                cbhttp->priv->icalstring = ecb_http_read_stream_sync (input_stream,
                        soup_message_headers_get_content_length (soup_message_get_response_headers 
(message)), cancellable, error);
                success =  cbhttp->priv->icalstring != NULL;
@@ -388,7 +389,7 @@ ecb_http_get_changes_sync (ECalMetaBackend *meta_backend,
 
        g_rec_mutex_lock (&cbhttp->priv->conn_lock);
 
-       if (!cbhttp->priv->message || !cbhttp->priv->icalstring) {
+       if (!cbhttp->priv->message) {
                g_rec_mutex_unlock (&cbhttp->priv->conn_lock);
                g_propagate_error (error, EC_ERROR (E_CLIENT_ERROR_REPOSITORY_OFFLINE));
                return FALSE;
@@ -402,6 +403,8 @@ ecb_http_get_changes_sync (ECalMetaBackend *meta_backend,
                return TRUE;
        }
 
+       g_warn_if_fail (cbhttp->priv->icalstring != NULL);
+
        new_etag = soup_message_headers_get_one (soup_message_get_response_headers (cbhttp->priv->message), 
"ETag");
        if (new_etag && !*new_etag) {
                new_etag = NULL;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]