1

i am currently trying to implement a „simple“ readonly CALDAV-interface for a system. But the synchronization protocol and the CALDAV-clients give me some headaches.

The main test client i use is the macos-calendar (sierra). The initial handshake (DAV principle, calendar lookup) and inital load of data is working. I get some REPORT:calendar-query requests. The issue is the incremental sync after initial load. There are two approaches:

  • Via WebSync-extension (REPORT:sync-collection and sync-token prop) my main issue here is that provisioning the sync-token from the server is not trivial in my system. Changes and New data is not an issue, but physical deletion (not yet logged in the user context) and changes in the scope of group- and/or role-assignments. Maybe i need to consider to invalidate in complex cases the sync-token and let the client resetup without sync-collection? A nasty workaround could be to retain the calendar item IDs send to the client and check on each request for their existence and responds if necessary with a not found per deleted/out of scope calendar item. But this would mean i store client-state on the server which doesnt sound right and might be error prone.

  • Via basic protocal synchronization (respond to REPORT:calendar-query and propfind (depth=1) requests no webdav-sync active) this is also working already in principle for new and changed data. But the macos-calendar doesnt remove items which are not part the collection response (propfind with depth=1). According to the protocol the client should determine the deleted items and remove them, but it doesnt do it in my case. Any ideas here? For my system currently it would be ideal to use this approach though the performance might be not the ideal one.

With ios-Calendar i face another issue:

  • Initial handshake is somehow working as the requests in the network are coming and are answered.

  • But than a MKCALENDAR request is coming (instead of a calendar-query or propfind for items) which answer with 403 as i also dont provide it in the Allow-header of the options response. the request looks like this:

MKCALENDAR /services/cal/_userid/220EDB4A-F00C-41C9-B78F-10781BBA77E4/ HTTP/1.1 Host: 127.0.0.1:8003 Content-Type: text/xml User-Agent: iOS/10.0.1 (14A403) dataaccessd/1.0 <?xml version="1.0" encoding="UTF-8"?> <B:mkcalendar xmlns:B="urn:ietf:params:xml:ns:caldav"> <A:set xmlns:A="DAV:"> <A:prop> <B:calendar-free-busy-set> <NO/> </B:calendar-free-busy-set> <D:calendar-order xmlns:D="http://apple.com/ns/ical/">1</D:calendar-order> <A:displayname>Kalender</A:displayname> <B:calendar-timezone>BEGIN:VCALENDAR ...deleted.... </B:calendar-timezone> <B:supported-calendar-component-set> <B:comp name="VEVENT"/> </B:supported-calendar-component-set> </A:prop> </A:set> </B:mkcalendar>

  • Nothing is happening afterwards.

  • Anyone experiencing this as well? Why ios-calendar tries to do a mkcalendar though i have a calendar-collection as resource-type?

With Thunderbird Lightning:

  • Initial handshake with the calendar-collection is working

  • A propfind-and multiget request for items is answered with iCal-Items.

  • But they are not displayed and in the error log i receive:

  • Warnung: CalDAV: Get failed: CalDAV: Error: got status 200 fetching calendar data for Debug Proxy, null

  • (text in german: error code: 0x80004005) Warnung: Fehler beim Lesen von Daten für Kalender: Debug Proxy. Allerdings ist dieser Fehler wahrscheinlich vernachlässigbar, daher versucht das Programm fortzufahren. Fehlercode: 0x80004005. Beschreibung: CalDAV: Error: got status 200 fetching calendar data for Debug Proxy, null

  • (text in german: error code: READ_FAILED) Warnung: Fehler beim Lesen von Daten für Kalender: Debug Proxy. Allerdings ist dieser Fehler wahrscheinlich vernachlässigbar, daher versucht das Programm fortzufahren. Fehlercode: READ_FAILED. Beschreibung:

  • http channel Listener OnDataAvailable contract violation

  • a similiar response is though working in macos-calendar – could it be some encoding issue?

Any hints are highly appreciated!

6
  • The SOP while developing a DAV server seems to be: 1. Read the specs. 2. Implement a server that corresponds to your interpretation of the specs. 3. Test with N actual clients, giving you N different interpretations of the specs. 4. Give up hope. 5. Throw everything away and copy an existing implementation.
    – CodeCaster
    Oct 12, 2016 at 13:33
  • All seriouslessness aside: this is too broad and unanswerable. There's not enough relevant information in your question for us to troubleshoot where exactly the issue is.
    – CodeCaster
    Oct 12, 2016 at 13:34
  • thanks for the reponse! i am clear about that you cannot track the issue in detail, but the question is if my assumptions mentioned are right or if there is already some flaw in it you might spot right away. Oct 12, 2016 at 14:16
  • I actually haven't seen different 'interpretations' of the spec, this is pretty straight forward. The hard part is figuring out what subset you need to implement to get up&running. If you actually implement the full spec (and Apple CalendarServer is probably the sole server which comes close to this) you should be good :-)
    – hnh
    Oct 12, 2016 at 23:38
  • @hnh it's been a few years since I last touched CalDAV. You're right in that it doesn't really come down to different interpretations, but more different levels of support. If you want to support common clients (Microsoft Outlook with various plugins, Mozilla Thunderbird + Lightning, Apple iCal) you need to implement different subsets of the specs, each with their own caveats.
    – CodeCaster
    Oct 13, 2016 at 11:16

2 Answers 2

4

This is indeed a pretty broad question. But let me try to address some stuff:

Via WebSync-extension (REPORT:sync-collection and sync-token prop) my main issue here is that provisioning the sync-token from the server is not trivial in my system

Even if it is hard for you, you should really try to come up with something here. Even if this means storing some extra info on the server. Sync-collection is way more efficient. (Idea: Maybe you can at least set a flag when something actually got deleted and only then expire the sync-token?)

Via basic protocal synchronization (respond to REPORT:calendar-query and propfind (depth=1))

Which one, calendar-range-query or PROPFIND? Completely different things ...

this is also working already in principle for new and changed data. But the macos-calendar doesnt remove items which are not part the collection response (propfind with depth=1).

If we are talking about a calendar-range-query, the client cannot proactively delete items since it doesn't know whether they just left the range (vs being deleted).

With PROPFIND it should do this. If you have proof it doesn't, maybe create another question with all the relevant details.

With ios-Calendar i face another issue: ... a MKCALENDAR request is coming ...

This probably means that it can't find the default scheduling calendar, no calendar at all, none with a proper component-type property. Or all the same for todos (Reminders app, same account). What is the payload of the MKCALENDAR? Hard to diagnose w/o details, if you can't figure it out, ask a specific question on this with all the relevant details included (e.g. the XML you send in response to the home query).

Thunderbird Lightning

Can't say much about this, probably depends a lot on the version and what extensions you are using. AFAIK many people use the ScalableOGo Thunderbird extensions to get proper Cal/CardDAV with Thunderbird.

5
  • sync-collection: i understand, will try to dig into this further basic-sync: the requests include a calendar-query which contains data/items in the response, but later still a propfind with depth=1 for item data is send. maybe that is exactly the issue that it tries both ways (calendar query + propfind) i respond currently only with dav: 1, calendar-access and allow: OPTIONS, PROPFIND, HEAD, GET, REPORT ios-Cal: the payload of the mkcalendar i pasted above thunderbird: thanks will try the other extension!!! ;-) Oct 13, 2016 at 9:02
  • you really need to include the payloads ... (eg use gists?) and make separate, well defined questions. it really makes no sense to make this question any bigger. address separate issues in individual questions.
    – hnh
    Oct 13, 2016 at 9:13
  • i was able now to make my first issue running - not sure what caused the issue, but i suppose that it was not encoded hrefs of my calendar items Oct 14, 2016 at 7:11
  • in addition i even suceeded with ios calendar! indeed it was a missing supported-calendar-component-set property in this case. macOS calendar was not relying on that apparently! :-) thanks hnh! Oct 14, 2016 at 7:13
  • Sounds good. Yes, many clients do not properly decode URLs but just store them as is. So it is important that the server delivers them in a consistent way (unfortunately).
    – hnh
    Oct 14, 2016 at 12:50
1

For Thunderbird/Lightning you may want to turn on calendar.debug.log and calendar.debug.log.verbose in the advanced config editor and restart. You can find it in Options > Advanced > General > Config Editor. This will get you more detailed http requests and information about what failed. You can also hook up the remote debugger and look at the network monitor, or set breakpoints in the code.

With Thunderbird/Lightning please note that we are using a mix of previous and current versions of the webdav-sync draft. I can't say much from the error message as is given it is very general, but it does look like there is something unexpected in the results.

Maybe it makes sense to compare the handshake between an existing server (like sabre/dav) and the client, then see where the difference between your communication and theirs is.

Also, you may be interested in the CalDAVTester from Apple, which checks server interoperability. Note however that it does contain various apple specific tests. The folks at CalConnect are working together with Apple to make it more generally usable and to split out the Apple-specific tests. Given your server is read-only, don't expect everything to work, but you can hunt for fixing specific tests.

4
  • 1
    Philipp: Do not use 'previous' and 'current' versions of the webdav-sync draft. Use RFC 6578. It is from March 2012! :-)
    – hnh
    Oct 13, 2016 at 12:15
  • i had enabled the thunderbird logs for calendar already. I had also downloaded the caldavtester but failed so far with the configuration of the python scripts. suppose that it is still something with encoding, though the ical-content seems to be valid according to some ical online tester. will investigate further and might ask separatly again. ;) Oct 14, 2016 at 7:15
  • @hnh I agree it would be good in an ideal world to just drop support for the old drafts of webdav-sync, but as with clients, there are servers out there that do not work well with the RFC and require the old draft. The hybrid approach we have now has worked reasonably well with both old and new servers, if this is not the case please do file a bug. Oct 14, 2016 at 17:57
  • i have compiled a detailed question regarding thunderbird: stackoverflow.com/questions/40467053/… Nov 7, 2016 at 14:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.