diff --git a/inc/caldav-PROPFIND.php b/inc/caldav-PROPFIND.php index 72e4b808..50aac4f4 100644 --- a/inc/caldav-PROPFIND.php +++ b/inc/caldav-PROPFIND.php @@ -117,6 +117,12 @@ function namespace_array() { } +function calendar_server_tag( $tag ) { + add_namespace("A", "http://calendarserver.org/ns/"); + return ns_tag( $tag, 'http://calendarserver.org/ns/' ); +} + + function caldav_tag( $tag ) { return ns_tag( $tag, 'urn:ietf:params:xml:ns:caldav' ); } @@ -158,6 +164,7 @@ foreach( $request->xml_tags AS $k => $v ) { case 'GETCONTENTLENGTH': /** getcontentlength- should work fine */ case 'GETCONTENTTYPE': /** getcontenttype - should work fine */ case 'GETETAG': /** getetag - should work fine */ + case 'GETCTAG': /** Calendar Server extension like etag - should work fine (we just return etag) */ case 'SUPPORTEDLOCK': /** supportedlock - should work fine */ case 'PRINCIPAL-URL': /** principal-url - should work fine */ case 'RESOURCETYPE': /** resourcetype - should work fine */ @@ -291,12 +298,10 @@ function add_principal_properties( &$prop, &$not_found, &$denied ) { } if ( isset($attribute_list['DROPBOX-HOME-URL'] ) ) { - add_namespace("A", "http://calendarserver.org/ns/"); - $prop->NewElement("A:dropbox-home-url", new XMLElement('href', $request->principal->dropbox_url) ); + $prop->NewElement(calendar_server_tag("dropbox-home-url"), new XMLElement('href', $request->principal->dropbox_url) ); } if ( isset($attribute_list['NOTIFICATIONS-URL'] ) ) { - add_namespace("A", "http://calendarserver.org/ns/"); - $prop->NewElement("A:notifications-url", new XMLElement('href', $request->principal->notifications_url) ); + $prop->NewElement(calendar_server_tag("notifications-url"), new XMLElement('href', $request->principal->notifications_url) ); } if ( isset($attribute_list['CALENDAR-USER-ADDRESS-SET'] ) ) { @@ -379,6 +384,10 @@ function collection_to_xml( $collection ) { if ( isset($attribute_list['ALLPROP']) || isset($attribute_list['GETETAG']) ) { $prop->NewElement("getetag", '"'.$collection->dav_etag.'"' ); } + if ( isset($attribute_list['GETCTAG']) ) { + // Calendar Server extension which only applies to collections. We return the etag, which does the needful. + $prop->NewElement(calendar_server_tag('getctag'),$collection->dav_etag ); + } if ( isset($attribute_list['ALLPROP']) || isset($attribute_list['CURRENT-USER-PRIVILEGE-SET']) ) { $prop->NewElement("current-user-privilege-set", privileges($request->permissions) ); } diff --git a/testing/tests/regression-suite/503-iCal-PROPFIND.result b/testing/tests/regression-suite/503-iCal-PROPFIND.result index 3cc4b197..f07aa16f 100644 --- a/testing/tests/regression-suite/503-iCal-PROPFIND.result +++ b/testing/tests/regression-suite/503-iCal-PROPFIND.result @@ -1,12 +1,12 @@ HTTP/1.1 207 Multi-Status Date: Dow, 01 Jan 2000 00:00:00 GMT DAV: 1, 2, access-control, calendar-access -ETag: "45e62f9b3b6b55ac40673d4ef35948b9" -Content-Length: 623 +ETag: "f5bcdac4101184e674bfb4112dfe4b0c" +Content-Length: 666 Content-Type: text/xml; charset="utf-8" - + /caldav.php/user1/home/ @@ -16,13 +16,13 @@ Content-Type: text/xml; charset="utf-8" home + faf25336de0e470a54075c14cbcf5272 HTTP/1.1 200 OK - - + HTTP/1.1 404 Not Found