From 34de8431aebbf0e1469d55def277f4359a58f868 Mon Sep 17 00:00:00 2001 From: Ricki Hirner Date: Wed, 21 Oct 2015 12:47:12 +0200 Subject: [PATCH] Fallback to PROPFIND when REPORT addressbook-query returns 400, 403, 500 or 501 * increase max. log line length to 80 characters --- app/src/main/java/at/bitfire/davdroid/HttpClient.java | 2 +- .../bitfire/davdroid/syncadapter/ContactsSyncManager.java | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/at/bitfire/davdroid/HttpClient.java b/app/src/main/java/at/bitfire/davdroid/HttpClient.java index 22ed23a8..8362c4f4 100644 --- a/app/src/main/java/at/bitfire/davdroid/HttpClient.java +++ b/app/src/main/java/at/bitfire/davdroid/HttpClient.java @@ -33,7 +33,7 @@ import de.duenndns.ssl.MemorizingTrustManager; import lombok.RequiredArgsConstructor; public class HttpClient extends OkHttpClient { - private final int MAX_LOG_LINE_LENGTH = 71; + private final int MAX_LOG_LINE_LENGTH = 80; final static UserAgentInterceptor userAgentInterceptor = new UserAgentInterceptor(); diff --git a/app/src/main/java/at/bitfire/davdroid/syncadapter/ContactsSyncManager.java b/app/src/main/java/at/bitfire/davdroid/syncadapter/ContactsSyncManager.java index dfb89bcc..2ba238f3 100644 --- a/app/src/main/java/at/bitfire/davdroid/syncadapter/ContactsSyncManager.java +++ b/app/src/main/java/at/bitfire/davdroid/syncadapter/ContactsSyncManager.java @@ -117,7 +117,13 @@ public class ContactsSyncManager extends SyncManager { try { davAddressBook().addressbookQuery(); } catch(HttpException e) { - if (e.status/100 == 4) { + /* non-successful responses to CARDDAV:addressbook-query with empty filter, tested on 2015/10/21 + * fastmail.com 403 Forbidden (DAV:error CARDDAV:supported-filter) + * mailbox.org (OpenXchange) 400 Bad Request + * SOGo 207 Multi-status, but without entries http://www.sogo.nu/bugs/view.php?id=3370 + * Zimbra ZCS 500 Server Error https://bugzilla.zimbra.com/show_bug.cgi?id=101902 + */ + if (e.status == 400 || e.status == 403 || e.status == 500 || e.status == 501) { log.warn("Server error on REPORT addressbook-query, falling back to PROPFIND", e); davAddressBook().propfind(1, GetETag.NAME); } else