【问题标题】:Developing Carddav/Caldav Server. Events disappear clientside on iOS after syncing开发 Carddav/Caldav 服务器。同步后,事件在 iOS 客户端消失
【发布时间】:2015-12-14 14:50:37
【问题描述】:

我目前正在开发一个 carddav / caldav 服务器。我已经可以在 windows/windows phone/android 上与很多客户端进行通信。现在我尝试与 iOS 同步。地址簿同步工作正常,但日历应用程序表现奇怪。它同步所有日历和约会并正确显示它们。它甚至将事件的参与者链接到地址簿中的联系人。但是一旦同步完成,日历和约会就会完全消失。有人有提示吗?

我的测试设备是装有 iOS 8.3 (12F69) 的 iPad 2。

这里是交流。我忽略了没有授权标头的请求。我还必须编辑主机名,但在所有请求期间都是相同的。

iOS 询问的很多属性我都没有回答。但由于所有约会都在短时间内正确显示,因此不需要这些。还有很多不是 caldav 规范的一部分(但仍然放在同一个 xmlns 中?)。

初步建议

请求

PROPFIND host:9998/.well-known/caldav HTTP/1.1
Host: host:9998
User-Agent: iOS/8.3 (12F69) accountsd/1.0
Accept-Language: de-de
Accept-Encoding: gzip, deflate
Accept: */*
Content-Type: text/xml
Prefer: return=minimal
Depth: 0
Connection: keep-alive
Authorization: Basic ZmdoZ2poZ2g6a2dmZ2hqaA==
Content-Length: 181
Brief: t

<?xml version="1.0" encoding="UTF-8"?>
<A:propfind xmlns:A="DAV:">
  <A:prop>
    <A:current-user-principal/>
    <A:principal-URL/>
    <A:resourcetype/>
  </A:prop>
</A:propfind>

响应

HTTP/1.1 207 Multi-Status
Server: Apache-Coyote/1.1
Allow: OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, REPORT
DAV: 1, 3, extended-mkcol, addressbook, access-control, calendar-access
MS-Author-Via: DAV
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
Accept-Ranges: bytes
Content-Type: text/xml
Content-Length: 791
Date: Tue, 15 Dec 2015 08:25:22 GMT

<?xml version="1.0" encoding="UTF-8"?>
<d:multistatus xmlns:d="DAV:" xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:card="urn:ietf:params:xml:ns:carddav" xmlns:cs="http://calendarserver.org/ns/">
  <d:response>
    <d:href>/.well-known/caldav/</d:href>
    <d:propstat>
      <d:prop>
        <d:resourcetype>
          <d:collection/>
        </d:resourcetype>
        <d:current-user-principal>
          <d:href>/.well-known/caldav/DEVELOPMENT/principals/Robert%20Glaser/</d:href>
        </d:current-user-principal>
        <d:principal-url>
          <d:href>/.well-known/caldav/DEVELOPMENT/principals/Robert%20Glaser/</d:href>
        </d:principal-url>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
</d:multistatus>

选项

请求

OPTIONS http://host:9998/.well-known/caldav/DEVELOPMENT/principals/Robert%20Glaser/ HTTP/1.1
Host: host:9998
Authorization: Basic bW5iam5ia2tqaHZmOm1oZ2o=
Accept-Encoding: gzip, deflate
Accept: */*
Content-Length: 0
Accept-Language: de-de
Connection: keep-alive
User-Agent: iOS/8.3 (12F69) accountsd/1.0

响应

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Allow: OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, REPORT
DAV: 1, 3, extended-mkcol, addressbook, access-control, calendar-access
MS-Author-Via: DAV
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
Accept-Ranges: bytes
Content-Type: text/xml
Content-Length: 0
Date: Tue, 15 Dec 2015 08:25:22 GMT

Propfind(这里很多属性我不回答)

请求

PROPFIND host:9998/.well-known/caldav/DEVELOPMENT/principals/Robert%20Glaser/ HTTP/1.1
Host: host:9998
User-Agent: iOS/8.3 (12F69) dataaccessd/1.0
Accept-Language: de-de
Accept-Encoding: gzip, deflate
Accept: */*
Content-Type: text/xml
Prefer: return=minimal
Depth: 0
Connection: keep-alive
Authorization: Basic bW5iam5ia2tqaHZmOm1oZ2o=
Content-Length: 743
Brief: t
<A:propfind xmlns:A="DAV:">
  <A:prop>
    <B:calendar-home-set xmlns:B="urn:ietf:params:xml:ns:caldav"/>
    <B:calendar-user-address-set xmlns:B="urn:ietf:params:xml:ns:caldav"/>
    <A:current-user-principal/>
    <A:displayname/>
    <C:dropbox-home-URL xmlns:C="http://calendarserver.org/ns/"/>
    <C:email-address-set xmlns:C="http://calendarserver.org/ns/"/>
    <C:notification-URL xmlns:C="http://calendarserver.org/ns/"/>
    <A:principal-collection-set/>
    <A:principal-URL/>
    <A:resource-id/>
    <B:schedule-inbox-URL xmlns:B="urn:ietf:params:xml:ns:caldav"/>
    <B:schedule-outbox-URL xmlns:B="urn:ietf:params:xml:ns:caldav"/>
    <A:supported-report-set/>
  </A:prop>
</A:propfind>

响应

HTTP/1.1 207 Multi-Status
Server: Apache-Coyote/1.1
Allow: OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, REPORT
DAV: 1, 3, extended-mkcol, addressbook, access-control, calendar-access
MS-Author-Via: DAV
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
Accept-Ranges: bytes
Content-Type: text/xml
Content-Length: 958
Date: Tue, 15 Dec 2015 08:25:48 GMT

<?xml version="1.0" encoding="UTF-8"?>
<d:multistatus xmlns:d="DAV:" xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:card="urn:ietf:params:xml:ns:carddav" xmlns:cs="http://calendarserver.org/ns/">
  <d:response>
    <d:href>/.well-known/caldav/DEVELOPMENT/principals/Robert%20Glaser/</d:href>
    <d:propstat>
      <d:prop>
        <d:displayname>Robert Glaser</d:displayname>
        <d:current-user-principal>
          <d:href>/.well-known/caldav/DEVELOPMENT/principals/Robert%20Glaser/</d:href>
        </d:current-user-principal>
        <cal:calendar-home-set>
          <d:href>/.well-known/caldav/DEVELOPMENT/calendars/Robert%20Glaser/</d:href>
        </cal:calendar-home-set>
        <d:principal-url>
          <d:href>/.well-known/caldav/DEVELOPMENT/principals/Robert%20Glaser/</d:href>
        </d:principal-url>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
</d:multistatus>

建议

请求

PROPFIND http://host:9998/.well-known/carddav/DEVELOPMENT/principals/Robert%20Glaser/ HTTP/1.1
Host: host:9998
User-Agent: iOS/8.3 (12F69) dataaccessd/1.0
Accept-Language: de-de
Accept-Encoding: gzip, deflate
Accept: */*
Content-Type: text/xml
Prefer: return=minimal
Depth: 0
Connection: keep-alive
Authorization: Basic Z2poZ2o6amhqamo=
Content-Length: 439
Brief: t

<?xml version="1.0" encoding="UTF-8"?>
<A:propfind xmlns:A="DAV:">
  <A:prop>
    <D:addressbook-home-set xmlns:D="urn:ietf:params:xml:ns:carddav"/>
    <D:directory-gateway xmlns:D="urn:ietf:params:xml:ns:carddav"/>
    <A:displayname/>
    <C:email-address-set xmlns:C="http://calendarserver.org/ns/"/>
    <A:principal-collection-set/>
    <A:principal-URL/>
    <A:resource-id/>
    <A:supported-report-set/>
  </A:prop>
</A:propfind>

响应

HTTP/1.1 207 Multi-Status
Server: Apache-Coyote/1.1
Allow: OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, REPORT
DAV: 1, 3, extended-mkcol, addressbook, access-control, calendar-access
MS-Author-Via: DAV
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
Accept-Ranges: bytes
Content-Type: text/xml
Content-Length: 795
Date: Tue, 15 Dec 2015 08:25:48 GMT

<?xml version="1.0" encoding="UTF-8"?>
<d:multistatus xmlns:d="DAV:" xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:card="urn:ietf:params:xml:ns:carddav" xmlns:cs="http://calendarserver.org/ns/">
  <d:response>
    <d:href>/.well-known/carddav/DEVELOPMENT/principals/Robert%20Glaser/</d:href>
    <d:propstat>
      <d:prop>
        <d:displayname>Robert Glaser</d:displayname>
        <card:addressbook-home-set>
          <d:href>/.well-known/carddav/DEVELOPMENT/addressbooks/</d:href>
        </card:addressbook-home-set>
        <d:principal-url>
          <d:href>/.well-known/carddav/DEVELOPMENT/principals/Robert%20Glaser/</d:href>
        </d:principal-url>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
</d:multistatus>

建议

请求

PROPFIND http://host:9998/.well-known/caldav/DEVELOPMENT/calendars/Robert%20Glaser/ HTTP/1.1
Host: host:9998
User-Agent: iOS/8.3 (12F69) dataaccessd/1.0
Accept-Language: de-de
Accept-Encoding: gzip, deflate
Accept: */*
Content-Type: text/xml
Prefer: return=minimal
Depth: 1
Connection: keep-alive
Authorization: Basic bW5iam5ia2tqaHZmOm1oZ2o=
Content-Length: 2097
Brief: t

<?xml version="1.0" encoding="UTF-8"?>
<A:propfind xmlns:A="DAV:">
  <A:prop>
    <A:add-member/>
    <C:allowed-sharing-modes xmlns:C="http://calendarserver.org/ns/"/>
    <F:autoprovisioned xmlns:F="http://apple.com/ns/ical/"/>
    <E:bulk-requests xmlns:E="http://me.com/_namespace/"/>
    <F:calendar-color xmlns:F="http://apple.com/ns/ical/"/>
    <B:calendar-description xmlns:B="urn:ietf:params:xml:ns:caldav"/>
    <B:calendar-free-busy-set xmlns:B="urn:ietf:params:xml:ns:caldav"/>
    <F:calendar-order xmlns:F="http://apple.com/ns/ical/"/>
    <B:calendar-timezone xmlns:B="urn:ietf:params:xml:ns:caldav"/>
    <A:current-user-privilege-set/>
    <B:default-alarm-vevent-date xmlns:B="urn:ietf:params:xml:ns:caldav"/>
    <B:default-alarm-vevent-datetime xmlns:B="urn:ietf:params:xml:ns:caldav"/>
    <A:displayname/>
    <C:getctag xmlns:C="http://calendarserver.org/ns/"/>
    <F:language-code xmlns:F="http://apple.com/ns/ical/"/>
    <F:location-code xmlns:F="http://apple.com/ns/ical/"/>
    <A:owner/>
    <C:pre-publish-url xmlns:C="http://calendarserver.org/ns/"/>
    <C:publish-url xmlns:C="http://calendarserver.org/ns/"/>
    <C:push-transports xmlns:C="http://calendarserver.org/ns/"/>
    <C:pushkey xmlns:C="http://calendarserver.org/ns/"/>
    <A:quota-available-bytes/>
    <A:quota-used-bytes/>
    <F:refreshrate xmlns:F="http://apple.com/ns/ical/"/>
    <A:resource-id/>
    <A:resourcetype/>
    <B:schedule-calendar-transp xmlns:B="urn:ietf:params:xml:ns:caldav"/>
    <B:schedule-default-calendar-URL xmlns:B="urn:ietf:params:xml:ns:caldav"/>
    <C:source xmlns:C="http://calendarserver.org/ns/"/>
    <C:subscribed-strip-alarms xmlns:C="http://calendarserver.org/ns/"/>
    <C:subscribed-strip-attachments xmlns:C="http://calendarserver.org/ns/"/>
    <C:subscribed-strip-todos xmlns:C="http://calendarserver.org/ns/"/>
    <B:supported-calendar-component-set xmlns:B="urn:ietf:params:xml:ns:caldav"/>
    <B:supported-calendar-component-sets xmlns:B="urn:ietf:params:xml:ns:caldav"/>
    <A:supported-report-set/>
    <A:sync-token/>
  </A:prop>
</A:propfind>

响应

HTTP/1.1 207 Multi-Status
Server: Apache-Coyote/1.1
Allow: OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, REPORT
DAV: 1, 3, extended-mkcol, addressbook, access-control, calendar-access
MS-Author-Via: DAV
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
Accept-Ranges: bytes
Content-Type: text/xml
Content-Length: 2984
Date: Tue, 15 Dec 2015 08:25:49 GMT

<?xml version="1.0" encoding="UTF-8"?>
<d:multistatus xmlns:d="DAV:" xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:card="urn:ietf:params:xml:ns:carddav" xmlns:cs="http://calendarserver.org/ns/">
  <d:response>
    <d:href>/.well-known/caldav/DEVELOPMENT/calendars/Robert%20Glaser/</d:href>
    <d:propstat>
      <d:prop>
        <d:resourcetype>
          <d:collection/>
        </d:resourcetype>
        <cs:getctag/>
        <d:displayname>Robert Glaser</d:displayname>
        <d:current-user-privilege-set>
          <d:privilege>
            <d:all/>
          </d:privilege>
          <d:privilege>
            <d:read/>
          </d:privilege>
          <d:privilege>
            <d:read-acl/>
          </d:privilege>
          <d:privilege>
            <d:write/>
          </d:privilege>
          <d:privilege>
            <d:write-content/>
          </d:privilege>
          <d:privilege>
            <d:read-current-user-privilege-set/>
          </d:privilege>
        </d:current-user-privilege-set>
        <d:owner>
          <d:href>/.well-known/caldav/DEVELOPMENT/principals/Robert%20Glaser/</d:href>
        </d:owner>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
  <d:response>
    <d:href>/.well-known/caldav/DEVELOPMENT/calendars/Robert%20Glaser/Alle%20Termine/</d:href>
    <d:propstat>
      <d:prop>
        <d:resourcetype>
          <d:collection/>
          <cal:calendar/>
        </d:resourcetype>
        <cs:getctag>669801837942</cs:getctag>
        <d:displayname>Alle Termine</d:displayname>
        <d:supported-report-set>
          <d:supported-report>
            <d:report>
              <cal:calendar-multiget/>
            </d:report>
          </d:supported-report>
          <d:supported-report>
            <d:report>
              <cal:calendar-query/>
            </d:report>
          </d:supported-report>
        </d:supported-report-set>
        <d:current-user-privilege-set>
          <d:privilege>
            <d:all/>
          </d:privilege>
          <d:privilege>
            <d:read/>
          </d:privilege>
          <d:privilege>
            <d:read-acl/>
          </d:privilege>
          <d:privilege>
            <d:write/>
          </d:privilege>
          <d:privilege>
            <d:write-content/>
          </d:privilege>
          <d:privilege>
            <d:read-current-user-privilege-set/>
          </d:privilege>
        </d:current-user-privilege-set>
        <cal:supported-calendar-component-set>
          <cal:comp name="VEVENT"/>
          <cal:comp name="VTIMEZONE"/>
        </cal:supported-calendar-component-set>
        <d:owner>
          <d:href>/.well-known/caldav/DEVELOPMENT/principals/Robert%20Glaser/</d:href>
        </d:owner>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
</d:multistatus>

Proppatch(未实现

请求

PROPPATCH http://host:9998/.well-known/caldav/DEVELOPMENT/calendars/Robert%20Glaser/Alle%20Termine/ HTTP/1.1
Host: host:9998
Authorization: Basic bW5iam5ia2tqaHZmOm1oZ2o=
Accept-Encoding: gzip, deflate
Content-Type: text/xml
Accept-Language: de-de
Content-Length: 198
Accept: */*
Connection: keep-alive
User-Agent: iOS/8.3 (12F69) dataaccessd/1.0

<?xml version="1.0" encoding="UTF-8"?>
<A:propertyupdate xmlns:A="DAV:"><A:set><A:prop><F:calendar-order xmlns:F="http://apple.com/ns/ical/">0</F:calendar-order></A:prop></A:set></A:propertyupdate>

响应

HTTP/1.1 501 Not Implemented
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=utf-8
Content-Language: en
Content-Length: 1029
Date: Tue, 15 Dec 2015 08:25:49 GMT
Connection: close

<!DOCTYPE html><html><head><title>Apache Tomcat/8.0.24 - Error report</title><style type="text/css">H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}.line {height: 1px; background-color: #525D76; border: none;}</style> </head><body><h1>HTTP Status 501 - </h1><div class="line"></div><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server does not support the functionality needed to fulfill this request.</u></p><hr class="line"><h3>Apache Tomcat/8.0.24</h3></body></html>

建议

请求

PROPFIND http://host:9998/.well-known/caldav/DEVELOPMENT/principals/Robert%20Glaser/ HTTP/1.1
Host: host:9998
User-Agent: iOS/8.3 (12F69) dataaccessd/1.0
Accept-Language: de-de
Accept-Encoding: gzip, deflate
Accept: */*
Content-Type: text/xml
Prefer: return=minimal
Depth: 0
Connection: keep-alive
Authorization: Basic bW5iam5ia2tqaHZmOm1oZ2o=
Content-Length: 267
Brief: t

<?xml version="1.0" encoding="UTF-8"?>
<A:propfind xmlns:A="DAV:">
  <A:prop>
    <B:calendar-user-address-set xmlns:B="urn:ietf:params:xml:ns:caldav"/>
    <A:displayname/>
    <C:email-address-set xmlns:C="http://calendarserver.org/ns/"/>
  </A:prop>
</A:propfind>

响应

HTTP/1.1 207 Multi-Status
Server: Apache-Coyote/1.1
Allow: OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, REPORT
DAV: 1, 3, extended-mkcol, addressbook, access-control, calendar-access
MS-Author-Via: DAV
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
Accept-Ranges: bytes
Content-Type: text/xml
Content-Length: 500
Date: Tue, 15 Dec 2015 08:25:49 GMT

<?xml version="1.0" encoding="UTF-8"?>
<d:multistatus xmlns:d="DAV:" xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:card="urn:ietf:params:xml:ns:carddav" xmlns:cs="http://calendarserver.org/ns/">
  <d:response>
    <d:href>/.well-known/caldav/DEVELOPMENT/principals/Robert%20Glaser/</d:href>
    <d:propstat>
      <d:prop>
        <d:displayname>Robert Glaser</d:displayname>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
</d:multistatus>

MKCALENDAR(未实现)

请求

MKCALENDAR http://host:9998/.well-known/caldav/DEVELOPMENT/calendars/Robert%20Glaser/B39676BE-F124-475E-9ED2-B8756951DF29/ HTTP/1.1
Host: host:9998
Authorization: Basic bW5iam5ia2tqaHZmOm1oZ2o=
Accept-Encoding: gzip, deflate
Content-Type: text/xml
Accept-Language: de-de
Content-Length: 1046
Accept: */*
Connection: keep-alive
User-Agent: iOS/8.3 (12F69) 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>
      <F:calendar-order xmlns:F="http://apple.com/ns/ical/">0</F:calendar-order>
      <B:calendar-timezone>BEGIN:VCALENDAR&#13;
VERSION:2.0&#13;
CALSCALE:GREGORIAN&#13;
BEGIN:VTIMEZONE&#13;
TZID:Europe/Berlin&#13;
BEGIN:DAYLIGHT&#13;
TZOFFSETFROM:+0100&#13;
TZNAME:MESZ&#13;
TZOFFSETTO:+0200&#13;
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU&#13;
DTSTART:19810329T020000&#13;
END:DAYLIGHT&#13;
BEGIN:STANDARD&#13;
TZOFFSETFROM:+0200&#13;
TZNAME:MEZ&#13;
TZOFFSETTO:+0100&#13;
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU&#13;
DTSTART:19961027T030000&#13;
END:STANDARD&#13;
END:VTIMEZONE&#13;
END:VCALENDAR&#13;
</B:calendar-timezone>
      <A:displayname>Erinnerungen</A:displayname>
      <B:calendar-free-busy-set>
        <NO/>
      </B:calendar-free-busy-set>
      <B:supported-calendar-component-set>
        <B:comp name="VTODO"/>
      </B:supported-calendar-component-set>
    </A:prop>
  </A:set>
</B:mkcalendar>

响应

HTTP/1.1 501 Not Implemented
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=utf-8
Content-Language: en
Content-Length: 1029
Date: Tue, 15 Dec 2015 08:25:49 GMT
Connection: close

<!DOCTYPE html><html><head><title>Apache Tomcat/8.0.24 - Error report</title><style type="text/css">H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}.line {height: 1px; background-color: #525D76; border: none;}</style> </head><body><h1>HTTP Status 501 - </h1><div class="line"></div><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server does not support the functionality needed to fulfill this request.</u></p><hr class="line"><h3>Apache Tomcat/8.0.24</h3></body></html>

Propfind(在日历上,我这里不回答同步令牌)

PROPFIND http://host:9998/.well-known/caldav/DEVELOPMENT/calendars/Robert%20Glaser/Alle%20Termine/ HTTP/1.1
Host: host:9998
User-Agent: iOS/8.3 (12F69) dataaccessd/1.0
Accept-Language: de-de
Accept-Encoding: gzip, deflate
Accept: */*
Content-Type: text/xml
Prefer: return=minimal
Depth: 0
Connection: keep-alive
Authorization: Basic bW5iam5ia2tqaHZmOm1oZ2o=
Content-Length: 181
Brief: t

<?xml version="1.0" encoding="UTF-8"?>
<A:propfind xmlns:A="DAV:">
  <A:prop>
    <C:getctag xmlns:C="http://calendarserver.org/ns/"/>
    <A:sync-token/>
  </A:prop>
</A:propfind>

响应

HTTP/1.1 207 Multi-Status
Server: Apache-Coyote/1.1
Allow: OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, REPORT
DAV: 1, 3, extended-mkcol, addressbook, access-control, calendar-access
MS-Author-Via: DAV
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
Accept-Ranges: bytes
Content-Type: text/xml
Content-Length: 507
Date: Tue, 15 Dec 2015 08:25:51 GMT

<?xml version="1.0" encoding="UTF-8"?>
<d:multistatus xmlns:d="DAV:" xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:card="urn:ietf:params:xml:ns:carddav" xmlns:cs="http://calendarserver.org/ns/">
  <d:response>
    <d:href>/.well-known/caldav/DEVELOPMENT/calendars/Robert%20Glaser/Alle%20Termine/</d:href>
    <d:propstat>
      <d:prop>
        <cs:getctag>669801837942</cs:getctag>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
</d:multistatus>

Propfind(查找所有约会)

请求

PROPFIND host:9998/.well-known/caldav/DEVELOPMENT/calendars/Robert%20Glaser/Alle%20Termine/ HTTP/1.1
Host: host:9998
User-Agent: iOS/8.3 (12F69) dataaccessd/1.0
Accept-Language: de-de
Accept-Encoding: gzip, deflate
Accept: */*
Content-Type: text/xml
Prefer: return=minimal
Depth: 1
Connection: keep-alive
Authorization: Basic bW5iam5ia2tqaHZmOm1oZ2o=
Content-Length: 145
Brief: t

<?xml version="1.0" encoding="UTF-8"?>
<A:propfind xmlns:A="DAV:">
  <A:prop>
    <A:getcontenttype/>
    <A:getetag/>
  </A:prop>
</A:propfind>

响应(响应中有更多约会,我在这里只显示第一个,但它们看起来都一样,不同的hrefs)

HTTP/1.1 207 Multi-Status
Server: Apache-Coyote/1.1
Allow: OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, REPORT
DAV: 1, 3, extended-mkcol, addressbook, access-control, calendar-access
MS-Author-Via: DAV
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
Accept-Ranges: bytes
Content-Type: text/xml
Transfer-Encoding: chunked
Date: Tue, 15 Dec 2015 08:25:54 GMT

2000
<?xml version="1.0" encoding="UTF-8"?>
<d:multistatus xmlns:d="DAV:" xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:card="urn:ietf:params:xml:ns:carddav" xmlns:cs="http://calendarserver.org/ns/">
  <d:response>
    <d:href>/.well-known/caldav/DEVELOPMENT/calendars/Robert%20Glaser/Alle%20Termine/</d:href>
    <d:propstat>
      <d:prop/>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
  <d:response>
    <d:href>/.well-known/caldav/DEVELOPMENT/calendars/Robert%20Glaser/Alle%20Termine/0075712608923743A35868DB6A589A31.ics</d:href>
    <d:propstat>
      <d:prop>
        <d:getetag>1241532994</d:getetag>
        <d:getcontenttype>text/calendar</d:getcontenttype>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
</d:multistatus>

报告(下载所有约会,再次省略其他href)

请求

REPORT http://host:9998/.well-known/caldav/DEVELOPMENT/calendars/Robert%20Glaser/Alle%20Termine/ HTTP/1.1
Host: host:9998
Authorization: Basic bW5iam5ia2tqaHZmOm1oZ2o=
Accept-Encoding: gzip, deflate
Content-Type: text/xml
Accept-Language: de-de
Content-Length: 7677
Accept: */*
Connection: keep-alive
User-Agent: iOS/8.3 (12F69) dataaccessd/1.0

<?xml version="1.0" encoding="UTF-8"?>
<B:calendar-multiget xmlns:B="urn:ietf:params:xml:ns:caldav">
  <A:prop xmlns:A="DAV:">
    <A:getetag/>
    <B:calendar-data/>
    <C:created-by xmlns:C="http://calendarserver.org/ns/"/>
    <C:updated-by xmlns:C="http://calendarserver.org/ns/"/>
    <B:schedule-tag/>
  </A:prop>
  <A:href xmlns:A="DAV:">/.well-known/caldav/DEVELOPMENT/calendars/Robert%20Glaser/Alle%20Termine/50EAF942E0AB35A1B81792F7AAB6027E.ics</A:href>
</B:calendar-multiget>

响应

HTTP/1.1 207 Multi-Status
Server: Apache-Coyote/1.1
Allow: OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, REPORT
DAV: 1, 3, extended-mkcol, addressbook, access-control, calendar-access
MS-Author-Via: DAV
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
Accept-Ranges: bytes
Content-Type: text/xml;charset=utf-8
Date: Tue, 15 Dec 2015 08:25:58 GMT
Content-Length: 58259

<?xml version="1.0" encoding="UTF-8"?>
<d:multistatus xmlns:d="DAV:" xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:card="urn:ietf:params:xml:ns:carddav" xmlns:cs="http://calendarserver.org/ns/">
  <d:response>
    <d:href>/.well-known/caldav/DEVELOPMENT/calendars/Robert%20Glaser/Alle%20Termine/50EAF942E0AB35A1B81792F7AAB6027E.ics</d:href>
    <d:propstat>
      <d:prop>
        <d:getetag>1447948122</d:getetag>
        <cal:calendar-data>BEGIN:VCALENDAR&#13;
CALSCALE:GREGORIAN&#13;
VERSION:2.0&#13;
PRODID:-//DE/RND/DAV/CALDAV &#13;
BEGIN:VEVENT&#13;
DTSTAMP:20151215T082555Z&#13;
CLASS:PUBLIC&#13;
DESCRIPTION:&#13;
DTSTART:20151120T070000Z&#13;
DTEND:20151120T073000Z&#13;
SUMMARY:NeuerMehrTeilnehmerTermin&#13;
TRANSP:OPAQUE&#13;
ATTENDEE;CN=Robert Glaser;PARTSTAT=ACCEPTED:mailto:robert.glaser@web.de&#13;
RESOURCES:Audi A6&#13;
UID:50EAF942E0AB35A1B81792F7AAB6027E&#13;
CREATED:20151119T154839Z&#13;
LAST-MODIFIED:20151119T154839Z&#13;
END:VEVENT&#13;
END:VCALENDAR&#13;
</cal:calendar-data>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
</d:multistatus>

在此之后,还有 4 个 REPORT 请求来获取所有约会。 之后,在主机的根目录中有一个 propfind 请求,由于 30.000 个字符的限制,我无法发布该请求。我无法回答这个请求,因为它没有到达我的 servlet。

感谢您的帮助。

【问题讨论】:

  • 请求和响应;需要!
  • 我添加了整个通讯,谢谢。

标签: ios calendar webdav caldav


【解决方案1】:

今天,我终于可以修复错误了。在第一个请求中,ios 要求提供主体-URL,我用主体-url 回答。此标记名的最后一部分必须用大写字母书写才能被 iOS 识别。它使用 URL 在同步后向委托人发出一个(在我看来毫无意义的)请求。

【讨论】:

    【解决方案2】:

    这是我的笔记:

    1. .well-known 下的整个 caldav 服务器很奇怪。 .well-known 路径仅用于重定向到真实位置。它不应该中断,但有可能。
    2. 一般来说,避免在 url 中使用百分比编码是一件好事,例如您的主要路径。同样,这应该不是问题,但我看到客户绊倒了。
    3. 您的 etag 需要用双引号括起来(也在 d:etag 元素中)。

    但我认为真正的罪魁祸首是您不支持同步令牌或 ctag。客户的应该在没有它们的情况下工作正常,但我所看到的现实是有些人没有。我觉得这是最有可能的问题,因为您描述的问题与初始同步后的同步有关。几乎所有客户端都会使用 ctag(现在许多客户端使用同步令牌)来确定集合中是否有任何更改。

    【讨论】:

    • 我做了所有这些,但仍然没有帮助。 To 2:我在 Android 上有一个客户端,由于 url 中的空格而无法同步。无论如何,我不再使用任何需要编码的字符了。我支持 ctag,但仅限于日历收藏。目前无法在任何其他集合上支持它。我现在正在以与众所周知路径中的 propfind 相同的方式回答根路径中的 propfind 请求。 iOS 现在同步两次,约会保留但在下一次同步期间消失。编辑也不起作用。但目前,我不能再花时间讨论这种 iOS 特有的奇怪行为了。
    • 你的UIDs 和 uri 在同步之间是否稳定?我注意到的另一件愚蠢的事情是我们首先将\r 编码为&amp;#13;,但这破坏了一些客户端(不知道是哪个客户端),所以我们也停止了这样做。
    • 我还想知道如果其中一个日历中只有一个损坏的事件是否有可能。把其他一切都搞砸了。你支持calendar-query吗?在您发布的任何内容中都没有日历查询请求,这有点奇怪。
    • 是的,我的 UID 和 UIR 是稳定的。我还尝试了一个日历,它只有一个简单的事件。相同的行为。是的,我支持日历查询。我也支持一些过滤器,比如 timerange-filter,但 iOS 似乎出于某种原因没有使用它。许多其他客户成功使用它。
    • 我的想法不多了 :( 但我还有两个:在连接 iPad 时使用 XCode,您可能能够从日历中看到一些日志消息客户端。最后,我想此时我会将您的 xml 与工作服务器的 xml 进行比较……一定有一些关键的区别:/对不起
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-25
    • 1970-01-01
    • 2013-02-01
    • 1970-01-01
    • 2011-12-07
    • 2018-04-27
    相关资源
    最近更新 更多