<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style>
</head>
<body><div style="font-family:Arial;">Ken knows this code best.  I bet there's something which is requiring that there's a user on the mboxname because we implement the same behaviour at FastMail by having a separate user on which shared resources are kept.  The DAV resources are stored per-user, and without a place to keep them for "shared calendars" that code might just not be accessible.  I'm sure it would be possible to create a shared DAV database as well for this case, but it just needs some programming effort.<br></div>
<div style="font-family:Arial;"><br>Bron.<br></div>
<div><br></div>
<div><br></div>
<div>On Sun, 8 Apr 2018, at 07:30, Anatoli wrote:<br></div>
<blockquote type="cite"><div style="font-family:Arial;">Hi All,<br></div>
<div style="font-family:Arial;"> <br></div>
<div style="font-family:Arial;"> I'm trying to understand the code responsible for enumerating user
    calendars (and xDAV resources in general) to try to make the
    discovery work for shared resources too (currently there's no way to
    access shared resources with Apple xDAV client implementation, yes
    with Thunderbird as it doesn't use the discovery mechanism, but
    instead should be pointed to the exact URL for each calendar). If I
    understand it correctly, the functionality is in imap/http_caldav.c.<br></div>
<div style="font-family:Arial;"> <br></div>
<div style="font-family:Arial;"> Could you please point me to the place where the enumeration occurs
    and briefly mention how the general workflow looks like?<br></div>
<div style="font-family:Arial;"> <br></div>
<div style="font-family:Arial;"> The client asks for:<br></div>
<div style="font-family:Arial;"> <br></div>
<div style="font-family:Arial;"> <span class="font" style="font-family:"Courier New"">PROPFIND
      /dav/calendars/user/<user@domain>/<br> <br> <A:propfind xmlns:A="DAV:"><br> ...</span></div>
<div style="font-family:Arial;"> <br></div>
<div style="font-family:Arial;"> The server responds with:<br></div>
<div style="font-family:Arial;"> <br></div>
<div style="font-family:Arial;"> <span class="font" style="font-family:"Courier New"">HTTP/1.1 207 Multi-Status<br> <br> <A:multistatus xmlns:A="DAV:" ...><br>   <A:response><br>    
      <A:href>/dav/calendars/user/<user@domain>/</A:href><br>     <A:propstat><br> ...<br>   </A:response><br>   <A:response><br>    
<A:href>/dav/calendars/user/<user@domain>/Default/</A:href><br>     <A:propstat><br>       <A:prop><br> ...</span></div>
<div style="font-family:Arial;"> <br></div>
<div style="font-family:Arial;"> The idea is to include in the returned lists the shared calendars
    too with the discovery logic based on the IMAP shared folders.<br></div>
<div style="font-family:Arial;"> <br></div>
<div style="font-family:Arial;"> Below goes the initial exchange between the calendar app on iOS
    10.2.6 and Cyrus 3.0.5 when the exact URL (/dav/calendars/shared/)
    for the shared calendar is provided in the advanced settings of the
    app (the URL finally resets to the user principals folder
    (/dav/principals/user/t3@domain.com/) as iOS is pointed to it by
    Cyrus). In the attached file goes the telemetry for the rest of the
    communication.<br></div>
<div style="font-family:Arial;"> <br></div>
<div style="font-family:Arial;"> Thanks,<br></div>
<div style="font-family:Arial;"> Anatoli<br></div>
<div style="font-family:Arial;"> <br></div>
<div style="font-family:Arial;"> <span class="font" style="font-family:"Courier New"">---------- <a href="mailto:t3@domain.com">t3@domain.com</a> Sun Mar 25 06:05:36 2018<br> <br> <1521968736<<b>PROPFIND</b> <b>/dav/calendars/shared/</b> HTTP/1.1<br> Accept: */*<br> Content-type: text/xml<br> Connection: keep-alive<br> Content-length: 181<br> Host: mail.domain.com<br> User-agent: iOS/11.2.6 (15D100) accountsd/1.0<br> Prefer: return=minimal<br> Depth: 0<br> Brief: t<br> Accept-language: en-us<br> Authorization: Basic ...<br> Accept-encoding: br, gzip, deflate<br> <br> <1521968736<<?xml version="1.0" encoding="UTF-8"?><br> <A:propfind xmlns:A="DAV:"><br>   <A:prop><br>     <A:current-user-principal/><br>     <A:principal-URL/><br>     <A:resourcetype/><br>   </A:prop><br> </A:propfind><br> <br> <br> >1521968736>HTTP/1.1 207 Multi-Status<br> Date: Sun, 25 Mar 2018 09:05:36 GMT<br> Strict-Transport-Security: max-age=600<br> Vary: Accept-Encoding, Brief, Prefer<br> Preference-Applied: return=minimal<br> Content-Type: application/xml; charset=utf-8<br> Content-Length: 546<br> <br> <?xml version="1.0" encoding="utf-8"?><br> <A:multistatus xmlns:A="DAV:"
      xmlns:C="urn:ietf:params:xml:ns:caldav"><br>   <A:response><br>     <A:href><b>/dav/calendars/shared/</b></A:href><br>     <A:propstat><br>       <A:prop><br>         <A:current-user-principal><br>           <A:href><b>/dav/principals/user/t3@domain.com/</b></A:href><br>         </A:current-user-principal><br>         <A:resourcetype><br>           <A:collection/><br>           <C:calendar/><br>         </A:resourcetype><br>       </A:prop><br>       <A:status>HTTP/1.1 200 OK</A:status><br>     </A:propstat><br>   </A:response><br> </A:multistatus><br> <br> <1521968736<OPTIONS /dav/principals/user/t3%40domain.com/
      HTTP/1.1<br> Host: mail.domain.com<br> Connection: keep-alive<br> Accept: */*<br> User-Agent: iOS/11.2.6 (15D100) accountsd/1.0<br> Accept-Language: en-us<br> Content-Length: 0<br> Accept-Encoding: br, gzip, deflate<br> <br> >1521968736>HTTP/1.1 200 OK<br> Date: Sun, 25 Mar 2018 09:05:36 GMT<br> Strict-Transport-Security: max-age=600<br> Cache-Control: no-cache<br> Link: </dav/principals/.server-info>; rel="server-info";
      token="80769c2c66d340ecd178710db26d56b9c4699e3e"<br> DAV: 1, 2, 3, access-control, extended-mkcol, resource-sharing<br> DAV: calendar-access, calendar-auto-schedule<br> DAV: calendar-query-extended, calendar-availability,
      calendar-managed-attachments<br> DAV: calendarserver-sharing, inbox-availability<br> DAV: addressbook<br> Allow: OPTIONS, GET, HEAD<br> Allow: PROPFIND, REPORT, COPY<br> Content-Length: 0</span> </div>
<p>Email had 1 attachment:<br></p><ul><li><div style="font-family:Arial;"><code>telemetry.log</code><br></div>
<div style="font-family:Arial;">  36k (text/x-log)<br></div>
</li></ul></blockquote><div style="font-family:Arial;"><br></div>
<div id="sig56629417"><div class="signature">--<br></div>
<div class="signature">  Bron Gondwana, CEO, FastMail Pty Ltd<br></div>
<div class="signature">  brong@fastmailteam.com<br></div>
<div class="signature"><br></div>
</div>
<div style="font-family:Arial;"><br></div>
</body>
</html>