[evolution-data-server] CardDAV: Recognize OPTIONS 'Bad Request' response as success for Google



commit adbd6fc07033b639a990467009bce416b87ef855
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jun 3 10:50:33 2021 +0200

    CardDAV: Recognize OPTIONS 'Bad Request' response as success for Google
    
    The Google server rejects OPTIONS with a 'Bad Request' error, not with
    a 'Not Found' error. Let the code recognize it.

 src/addressbook/backends/carddav/e-book-backend-carddav.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/addressbook/backends/carddav/e-book-backend-carddav.c 
b/src/addressbook/backends/carddav/e-book-backend-carddav.c
index 393276246..0f587eaef 100644
--- a/src/addressbook/backends/carddav/e-book-backend-carddav.c
+++ b/src/addressbook/backends/carddav/e-book-backend-carddav.c
@@ -129,14 +129,16 @@ ebb_carddav_connect_sync (EBookMetaBackend *meta_backend,
                &capabilities, &allows, cancellable, &local_error);
 
        /* iCloud and Google servers can return "404 Not Found" when issued OPTIONS on the addressbook 
collection */
-       if (g_error_matches (local_error, SOUP_HTTP_ERROR, SOUP_STATUS_NOT_FOUND)) {
+       if (g_error_matches (local_error, SOUP_HTTP_ERROR, SOUP_STATUS_NOT_FOUND) ||
+           g_error_matches (local_error, SOUP_HTTP_ERROR, SOUP_STATUS_BAD_REQUEST)) {
                ESourceWebdav *webdav_extension;
                SoupURI *soup_uri;
 
                webdav_extension = e_source_get_extension (source, E_SOURCE_EXTENSION_WEBDAV_BACKEND);
                soup_uri = e_source_webdav_dup_soup_uri (webdav_extension);
                if (soup_uri) {
-                       if (soup_uri->host && soup_uri->path && *soup_uri->path &&
+                       if (g_error_matches (local_error, SOUP_HTTP_ERROR, SOUP_STATUS_NOT_FOUND) &&
+                           soup_uri->host && soup_uri->path && *soup_uri->path &&
                            e_util_utf8_strstrcase (soup_uri->host, ".icloud.com")) {
                                /* Try parent directory */
                                gchar *path;


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